Three very simple questions
livfoss at mac.com
Sun Apr 26 12:43:07 EDT 2020
Thanks Klaus, you are very patient with my stupid questions, as is Alex.
In general I am looking for ways to define stuff in the IDE to create objects and align them etc during the design phase, rather than make such essentially static things happen at run time. It seems silly to have to run a setting-up routine to do something that could have been set up once as a declaration before the program runs. Maybe that’s the legacy of HyperCard, where there wasn’t much of a difference between scripting a program and running it.
Apropos of alignment, of course you can do anything by script. I was just hoping the IDE could help with the static layout of objects on cards. Turns out it can, because the rather odd menu item in the IDE (“Align Selected Controls”) is not the whole story. Actually as Alex explains, you can get a more comprehensive set of alignments via the Property Inspector when multiple objects are selected. I just forgot about that. I wonder why the strangely incomplete menu item is there at all.
Arrays - Alex confirms there is no such thing as a constant declaration for arrays. Ah well. As to multi-dimensional arrays, I see the answer is “yes”, but I have to struggle to create the array (both structure and contents) rather than create it at design time as it were in the IDE as you would any other object. I will simply learn to live with it.
Sorry for all the bandwidth.
> On 26 Apr 2020, at 14:28, Klaus major-k via use-livecode <use-livecode at lists.runrev.com> wrote:
> Hi Graham,
> someone called my name? :-D
>> Am 26.04.2020 um 14:11 schrieb Graham Samuel via use-livecode <use-livecode at lists.runrev.com>:
>> I’m sending this again because some strange text appeared in my message the first time. Don’t know how it go there!
>> Folks, I’m finding it difficult to search the lessons and the LC Guide to get really simple info, so forgive me for these grossly newbie questions:
>> 1. In the IDE, the ‘Align Selected Controls’ menu item doesn’t allow all possible combinations of alignment, particularly aligning horizontal and vertical centres; nor does it allow alignments in relation to the stack dimensions. I think this functionality used to exist, but maybe (very likely!) my memory is faulty. If these functions are available somewhere in the IDE, I don’t see where.
> not sure I understand you correctly.
> If the inspector does not offer some alignement that you need, it will be easy to script, the inspector does the same.
>> particularly aligning horizontal and vertical centres
> Just use the two items of THE LOC OF WHATEVER to do youralignement:
> x -> horizontal centre
> y -> vertical centre
>> 2. I’ve not had to use LC arrays much, at least not ones containing my own data. The description of arrays is somewhat scattered throughout the lessons and the Guide, and I failed to find a thorough treatment of the whole idea of arrays in LC, which I find quite slippery. I am looking to use a two- or three-dimensional array, where you can script something like
>> put myArray[2,7] into…, or
>> get myArray[x,y,z]
>> I still don’t know if this is possible. I kind of think it is, but I can’t grasp how to do it.
> Yes, sure, but read up Alex last mail for "better" syntax.
>> 3. I can’t work out if you can construct an array using the IDE, i.e. prior to actually executing the code.
> That depends. :-D
> You can create an array whenever you need one and we can also store an array into a custom property,
> so it will survive the LC session if you save the stack.
> put "this is string1_1" into tArray["string1"]
> put "this is string1_2" into tArray["string2"]
> put "this is string2_1" into tArray["string1"]
> put "this is string2_1" into tArray["string2"]
> ## etc.
> answer "This is the string 1, stored in my array[string2]:" && tArray["string2"]
> Silly example, but you shlould get the picture...
> And if possible, named keys are much more readable
>> I was thinking for example of an array of constants (really strings) which could be written into my script. Again, if that’s possible I don’t know how. It seems odd to have to do something like convert lists of constants into array form only when the program is running.
> Well, when else would you like to do it in LC, when it is not running? :-D
> I'm sure I did nto really understand what you mean.
>> Somehow I don’t think this is possible in LC, but I’m not sure.
>> Maybe Klaus, who tells us that he sleeps with the LC documentation under his pillow, can help!
> Hope I did!
> Klaus Major
> klaus at major-k.de
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode