Group does not exist after "copy to this card"

Sannyasin Brahmanathaswami brahma at hindu.org
Fri Jul 7 15:18:53 EDT 2017


I doing this thing of saving a custom control in the loader stack on card 4..but it's behavior is text only stack on external to the stack

group "shareUI""

then I have a new init handler that adds the long id's of these controls

global sConfigA

to then it is super easy to do this anywhere anytime, on other stacks and modules (loader stack is always present in memory and these controls are not overloaded with images so they don't take up a lot of RAM in the app package)

copy sConfigA["shareContro"] to this card

the control copies and appears and it has a behavior that fires,

so far this is all very cool "brilliant" in fact…  a new world of view object/classes opens up! wow..

but after the copy is done, the engine still doesn't acknowledge that the grp exists

command sivasiva_Share
         put sConfigA["shareControl"] into tShareControl
put exists(group "shareUI") # false
copy tShareControl to this card # it works! buttons fire, behavior triggers Wow
put exists(group "shareUI") #  oops: still returns false
end sivasiva_Share

so there is no way to prevent the instantiation of multiple copies of the custom control…

I *could* copy this particular control to *all* stack on preopenstack and then assume it is present, but there are caveats there… and I want to stay on this path of dynamic instantiation of view "classes" as needed. It has so much potential.  I could also do the things of setting flags… but this adds complexity to what should be simple

if not [some control exists]
  create it by copying the template
else
assume its already there, ready to go
end if



So we *do* need to know if the control actually copied and is now present on the card, albeit in an unsaved state.

BR


More information about the use-livecode mailing list