Richard Gaskin wrote:
So for the foreseeable future, we have groups, sharable within a stack,
and clonable anywhere, even into other stacks.
---------------
BR:
Jacques taught this trick, I sure others do it also, but FWIW
Though "globals are bad" . I do use one global in the app for "fixed assets"
and not for holding runtime variables.
1) In init was we have
global sConfigA
2) start using "lib_CustomControl" # a binary stack, one group control per card
3) After all dependencies run, this:
on init_StoreControlsIds
put the long id of group "share-ui" of card "share-ui" of stack
"lib_CustomControls" into sConfigA["shareControl"]
put the long id of group "answerDlgGrp" of card "answerDlgGrp" of stack
"lib_CustomControls" into sConfigA["answerDialog"]
put the long id of group "bottomToast" of card "dialog_CustomMsg" of stack
"lib_CustomControls" into sConfigA["bottomToast"]
put the long id of group "searchControls" of card "search" of stack
"lib_CustomControls" into sConfigA["search"]
put the long id of group "sound-is-playing" of card "sound-is-playing" of
stack "lib_CustomControls" into sConfigA["soundIsPlaying"]
end init_StoreControlsIds
4) in any other stack we can do this:
Mouseup
case "share"
put sConfigA["shareControl"] into tShareControl
if (exists(group "share-ui" of this card) ) then
show group "share-ui" with visual dissolve very fast
else
copy tShareControl to this card
end if
break
running script profiler on this, the clone and show on a mouseup doesn't seem
to have any more than a 2 milliseconds hit on the CPU. Virtually, this method
has zero performance penalty. Of course the group is a "View" and cannot
contain persistence date.
Advantage is obvious: If you need to make a change to a group, you do so one
place, and it will appear "everywhere"
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode