Hi all, I'm trying to make a table like object where I can select any or all of the rows to have them show in the object (ie, only axon, stria and easylap), and have the rows reduce and the text move up so there are no gaps. Ideally, I'd like all the row options to be built into the object because if it's written in, I can't trust that anyone using it would go back and add the correct notes if the claddings change.
I feel like this is a long shot, but it's just so clunky as is, especially because it's highly unlikely that all of the options would be used on the one house, so you end up with a lot of useless information. So I would love some help because I have no idea where to even start with this.
First question is, can you script GDL objects?
Arrays, temp arrays and loops.
I have never tried it, but I figure you could make it so that you can remove any row during the array rewrites. Have one row in your array that is all 1s with the last value being 0 and when modified, is copied to a temp array. You then use this temp array to duplicate your main array for each value of 1 till it reaches a 0. Then run another copy that is offset in order to remove the 0. If a zero is not found, you increase the array size and define the last value as 0.
You could probably make use of arrays as Lingwiser has suggested, but I like to keep it simple.
The row of titles is a given, so that can just be coded as text with lines to form the boxes - you will always have this.
Then I would have boolean switches for each of the other rows, hardiplank, linear, axon, etc.
This way the user can choose to turn on/off what they want.
So I would script the title row.
Then use ADD2 to move down by one line.
Then ... IF hardiplank_switch = 1 then .... script that row ... ADD2 down one line ... ENDIF
IF linear_switch = 1 then .... script that row ... ADD2 down one line ... ENDIF
IF axon_switch = 1 then .... script that row ... ADD2 down one line ... ENDIF
... etc. for all of your rows.
This way you will always have the title and only those rows the user switches on.
If you want to get fancy you can allow the font and size to be chosen, then you can adjust widths by checking STW (string width) of all or just the widest column text, and also adjust the line height to allow for the font height.
That is what i would do, but there will be many other ways as well.
Depends if you have a fixed maximum number for rows I guess and if you care about how new values are ordered. If you have less than 10 at most, I might have the user input how many rows they want, then link the value of each column to a VALUES command. Though beyond 5, I might consider using a basic array to store the values rather than have a parameter for each and every cell.