Defaults for groups

Richard Gaskin ambassador at fourthworld.com
Sat May 14 15:56:03 CEST 2016


lc at pbh.on-rev.com lc wrote:

 > I thought you should be able to set the templateGroup properties,
 > maybe using a plugin that opens on LC startup, so I tried a test
 > stack and found that the templateGroup props don’t apply to a new
 > group (at least not the margins and borderWidth), the dictionary
 > suggests this should work, so I tried it in LC 7 - no luck, then LC 5
 > - still no luck! so I guess this is a long standing bug that doesn’t
 > affect anyone…

It's quantum:  setting the margins of the templateGroup both works and 
doesn't work. :)

This works:

on mouseUp
    set the margins of the templateGroup to 0
    create group
    put the margins of grp 1
end mouseUp

...but then commenting out line 1 and running it a second time doesn't.

I presume this is because the IDE resets the template objects in order 
for controls made with it to be consistent.

Understandable, but I would argue that that's backwards from what should 
be done.

The template objects are engine features, and for LiveCode to provide 
truly live coding the IDE needs to allow engine defaults as much as 
possible, to minimize confusing differences between development and 
runtime.  Indeed, that's the whole point of choosing an xTalk: 
development and runtime are the same thing, at least as much as 
possible.  We're coding live.

Obviously the IDE needs to set up objects we might drag from the Tools 
palette so they're consistent.

Right now it seems the IDE periodically resets the template objects, but 
this prevents developers from taking full advantage of that very 
valuable language feature.

I believe it would be better to add two lines of script to isolate the 
unique requirements of the IDE:

    put the properties of the templateGroup into tSaveProps
    DoStuffHere
    set the properties of the tenplateGroup to tSaveProps

If the IDE did that, we wouldn't need to do that every time we write a 
script that uses the template objects.

Indeed, if the template objects were left alone by the IDE, developers 
can very easily tailor their environment however they like with a very 
simple plugin.

And any apps they're writing that make good use of template objects 
would behave the same both in the IDE and as a standalone.  And that's 
rather the point of using an xTalk.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list