[Closed] Capturing Subobject level change?
Hi, I was wondering if there is some callback I can use to capture when the subobject level has been changed? So that I can dynamically load rollouts that are context sensitive.
More specificially for EPoly, but shouldn’t matter.
Hi Scorpian,
There is no callback to achieve this. All I can think of keep a global variable as to the subobjectlevel, and then use is to use registerredrawviewscallback and then test for a change.
Try this:
[font=Courier New][size=1]fn test =(format “Sub-object level=%
” subobjectlevel)
registerRedrawViewsCallback test
Josh.[/size][/font]
I now have another little question. How do you capture when a rolloutfloater is closed? I tried:
on <floater> closed do <expr>
But i think its invalid for rollout floaters.
I’ve been looking for it in the manual but no luck so far.
you were very close.
I use:
on floaterWindow close do (
– actions
)
- bret
hmm, yeah, sorry, I meant I used close*, but it still gave me a runtime error.
Basically what i wanted to do was, register a redraw callback in the main floater, then upon closing it, unregister it. sort of like a desctructor.
It compiles fine, but when i run it:
Runtime error: No such handler: #execute <<
EDIT:
Is it also possible to see which callbacks are registered after using the registerRedrawViewsCallback command? So that i can delete them if they are still left running after the rollout is closed?
in fact, according to the manual, those events dont even apply to rolloutFloaters!
They only apply to the Rollouts themselves.
If you look at the event syntax, they dont have the word Floater in the name:
on <rollout_or_utility> open do <expr>
on <rollout_or_utility> close do <expr>
on <rollout_or_utility> oktoclose do <expr>
but the ones that actually refer to rollout floater DO have it in the name, eg:
<rollout_floater>.pos Point2
in fact, i couldnt even find ANY events for rolloutFloaters specifically.
Please help
Perhaps you can create a Dialog window instead of a rollout floater, and use the “on rollout close do”. Just define a rollout “Myrollout” and use CreateDialog Myrollout 120 200. Looks pretty much the same as a roloutfloater. Of if you have a rollout on your rolloutfloater, use the “on rollout close” on that rollout.
CML
Scorpion,
may be your syntax is a little wrong. weather you use a dialog or a rollout floater the method is the same:
rollout floater:
fn test =(format “Sub-object level=%
” subobjectlevel)
rollout call “Test Callback.”
(
on call open do registerRedrawViewsCallback test
on call close do unregisterRedrawViewsCallback test
)
newroll=newrolloutfloater “test.” 270 180 600 100
addrollout call newroll
And for a Dialog box:
fn test =(format “Sub-object level=%
” subobjectlevel)
rollout call “Test Callback.”
(
on call open do registerRedrawViewsCallback test
on call close do unregisterRedrawViewsCallback test
)
createdialog call width:359 pos:(mouse.screenpos-[352,32]) height:30 style:#(#style_toolwindow,#style_sysmenu)
registerviewwindow call
I don’t think there is a way to check which redraw callbacks are registered, but when you call unregisterredrawcallback for test – unregisterRedrawViewsCallback test, all callbacks are removed.
J.
ah, you see, what I was doing was trying to find if the rolloutfloater was closed, not the ‘rollout’ itself, that is why it didnt work.
Rivendale, the reason I am using a rolloutfloater and not a dialog is because a dialog can only have 1 rollout, whereas a floater can have multiple rollouts inside it. (AFAIK)
Thanks for the advice, I’ll try that out now