[Closed] Registered Dialog Questions
Hi,
I'm having a few problems at the moment with registered dialogs.
1) When I try to find out the docking state of a registered dialog when the rollout is being closed, it complains about how the dialog isn't registered. Please see the test code below.
(
rollout testRoll "Test Rollout"
(
checkButton aBtn "Test Button" checked:false
on testRoll close do
(
format "closed - docking state = %
" (cui.getDockState testRoll)
)
)
createDialog testRoll style:#(#style_toolwindow)
cui.registerDialogBar testRoll style:#(#cui_dock_horz,#cui_floatable,#cui_handles)
)
2) I'm currently using a workaround to detect when a dialog is docked by using the 'moved' handler. Everytime I dock it, the handler will run, but when I undock it by dragging it back onto the viewport, it doesn't run the handler. Now if I dock it again, it doesn't run the handler. The only way I've found around this is to resize the dialog after undocking it and then it will run the handler. Again some test code below.
(
rollout testRoll "Test Rollout"
(
checkButton aBtn "Test Button" checked:false
on testRoll moved pos do
(
format "moved - docking state = %
" (try(cui.getDockState testRoll)catch())
)
)
createDialog testRoll style:#(#style_toolwindow)
cui.registerDialogBar testRoll style:#(#cui_dock_horz,#cui_floatable,#cui_handles)
)
Are there any workarounds for the 2 problems stated?
Thanks
I have a simular issue, but for some reason it also makes one of my global variables/structs to start behaving oddly. I’ve not manged to figure out way to determine when the dialog is docked/undocked yet, but I did do check to see if it is open (“rofMasterToolBar.open”) before performing some tasks…
My work flow goes something like this.
[ul]
[li]Run script (creates a global struct with reference to my float/cui toolbar). The toolbar is registered and docked automatically[/li][li]Undock the toolbar manually and close it[/li][li]Re-run the script…The script has a check to dispose of the original global variable/struct if it has previously been run. This will undock and dispose of the floater before it can be recreated – so you don’t end up with two toolbars. Here is where my problem starts…I don’t seem to be able to gain access to structs “referenced” functions. It acts as if the struct has not been instantiated…![/li][/ul]Now if I type it manually, I can access the varibles of the struct, but it has massive issues with the functions…
I know this does not help you, but I’m interested in knowing why this is happening
Shane
Not really answering your question but with the problem of not having two toolbars open, I use a global variable which tracks whether the rollout is open or not. If it isn’t open then it will create the dialog, but if it is, then it won’t create the dialog. Might not be the best and most elegant of solutions, but it seems to work. If there’s another solution to this, I’d be interested in it as well.
Anyone have any solutions to my original questions? I’ve kind of hit a wall and cannot think of even a workaround to this problem.
Thanks
Sorry, just bumping this thread as I really need a solution to the problems stated
How about using an oktoclose event instead of an onclose event?
global testRoll2
(
rollout testRoll2 "Test Rollout"
(
checkButton aBtn "Test Button" checked:false
on testRoll2 oktoclose do
(
format "closed - docking state = %
" (cui.getDockState testRoll2)
)
)
createDialog testRoll2 style:#(#style_toolwindow)
cui.registerDialogBar testRoll2 style:#(#cui_dock_horz,#cui_floatable,#cui_handles )
)
I guess the problem is that the code inside the close event is called AFTER the rollout has been closed and therefore no longer has a docking state. The oktoclose event comes BEFORE instead…and the rollout should still close properly.
After some testing I think that the events are just plain unreliable when used in conjunction with registered rollouts. I couldn´t find an alternative to the move code sorry…
Yeah I’m thinking of a different solution around this problem as I can’t seem to get it working at all as well.
Thanks for your time in helping me out MarcoBrunetta!