Group does not exist after "copy to this card"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Group does not exist after "copy to this card"

Richmond Mathewson via use-livecode
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
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Group does not exist after "copy to this card"

Richmond Mathewson via use-livecode
I have "not a clue", but it looks like no-one else had any good ideas,
so instead I'll make a couple of suggestions :-)

Try either of the following and see if it tells you anything.

command sivasiva_Share
    put sConfigA["shareControl"] into tShareControl
    put the name of the last control
    copy tShareControl to this card # it works! buttons fire, behavior triggers Wow
    put the name of the last control
end sivasiva_Share

or

command sivasiva_Share
    put sConfigA["shareControl"] into tShareControl
    put the number of controls
    copy tShareControl to this card # it works! buttons fire, behavior triggers Wow
    put the number of controls
end sivasiva_Share

If those don't help - try

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
    wait for 0 millisecs with messages   -- if this is safe in your environment !!
    put exists(group "shareUI") #  ???
end sivasiva_Share

Alex.

On 07/07/2017 20:18, Sannyasin Brahmanathaswami via use-livecode wrote:

> 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
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...