Page 1 of 1

External Layout Thought Bubble (RDMLX) UPDATED

Posted: Wed May 21, 2014 3:53 pm
by GregSippel
Fellow LongRangers,

Recently had an idea about how to externalise the screen logic from the application logic in my LongRange reusable parts. My goals where to be able to

* Remove 90% + of the commands in my reusable parts that deal with the look and feel (which generally take up most of the code)

* Increase the speed of developing/maintaining the look and feel

* Increase reusability of the look and feel elements

* Make it easier to switch layouts depending one need (i.e. phone & tablet), without having to either have different reusable parts or multiple if/then/else commands

Before developing this idea, I was using a reusable part to create my layouts. I posted http://longrange.lansa.com.au/viewtopic.php?f=12&t=75 this topic covering how I did it. The only issue I really found with this was still hard to change the look and feel because I was dealing with a compiled object. I was not able to just make a change and test. I had to compile first and then test.

So I created a reusable part that reads through a text file that contains the layout instructions (similar to RPG's new EZI example) and creates the LongRange property/value strings. The text file (see examples included) is arrange into three sections

<Form> - Everything here is a property of this form

<Grid> - This controls the grid layout of this form

<Fields name="XXX"> - This is a field to be added to the form with the following properties. Optionally the field can be placed into a different parent via parent="YYY"

The text files contents are transformed into LongRange instructions via a method I have called inflate. When you inflate you are able to specify the following

parent - which form or sub form do these instructions go into

index - used if this will be a repeating element, the name of the form has the index appended to it to ensure it is unique. The index is also accessible
via the %index% substitution marker.

parms - 01 - 10 values that can be passed into the layout and replace substitution markers such as %parm01%

Download and look at the examples I have created using this method, they should demonstrate the concept further. They should also show what I have found can be done thus far as I am still finding more things I can do each day. They also show how much code can be moved out a reusable part. Once out it can be reused, changed and enhanced much easier.

Remember this is just an idea I have had and it may or may not help you. I have posted it mainly to show there are many different ways in which you can build your LongRange applications. Not everything has to be in your RDMLX code.

Just note I have not tried to make this work in all situations (such as offline) yet but I believe it can be enhanced to do pretty much most things in time. Maybe you will have time to enhance it further.

Further Note : You will need RV16 and LongRange V 1.00.10

If you have any comments, queries or enhancements post them here.

UPDATED

The external layout builder has been updated to allow the following

* Add comment lines, they start with /*
* Ignore blank lines
* Allow external layout to be inflated into a popover, via the parameter intopopover (e.g. '/Form' creates '/Form.popover.type:Form')
* Basic error checking of layout and parameters usage, returned to the client app.
* Create items for Dropdowns via itemof attribute of <Fields>

Cheers

Greg Sippel
Professional Services Manager
LANSA Asia Pacific