PDA

View Full Version : how to trigger on rollout resize event only when i want it to


abyjoe
05-12-2008, 08:40 PM
the "on rollout resize" event is triggered whenever you resize the rollout.... i want to be able to resize only sometimes when i want and not always...

another ques: is it possible to exit the "on rollout resize" event?

cheers

ZeBoxx2
05-12-2008, 09:02 PM
I think you can only restrict resizing to width/height in createDialog.

You can certainly restrict it yourself via code - just force the <rollout>.width | <rollout>.height back to the desired value(s) in the resize event.

As for 'exiting' an event - not sure what you mean by that, but if you use 'return <whatever>', the remainder of the event shouldn't get parsed. Better to use if-then-else if possible, though.

abyjoe
05-13-2008, 02:15 AM
i am setting the resize width and height to a certain value if they get below the minimum.... but what this does is keeps resizing to that value and the floater keeps flickering... what i want to do is that after the minimum value of width is reached the resize event is not called at all...

even if you have a if then else loop it will still do the same...

ZeBoxx2
05-13-2008, 04:40 AM
well, that's what I meant - you can't limit it unless you limit it in the createDialog call. However, you can't then -un-limit it again.

The 'return' or 'if-then-else' will just exit the event or skip the code within the event. But the event is the result of the resize, not what drives or OK's the resize - so the resize has already happened at that point. That's why it flickers.

I don't think there's any way around this other than not making your dialog resizable in the first place, and handle any resizing yourself. E.g. if your user interface has certain controls that can be hidden and thus the dialog's size reduced when a certain feature is used, resize it from within code yourself.


rollout test "test" width:200 height:200 (
checkbutton ckb_test "test" pos:[4,4]
on ckb_test changed state do (
local size = case state of (
true:[50,50]
false:[200,200]
)
test.width = size.x
test.height = size.y
)
)
createDialog test lockWidth:true lockHeight:true

abyjoe
05-13-2008, 09:40 AM
thanks a lot zeboxx... that makes sence now... I didnt know we could lock the width and height in createdialog... cant use exit within the event handler as it says not in loop even if it is in the for loop...

cheers

CGTalk Moderation
05-13-2008, 09:40 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.