PDA

View Full Version : Button.enabled state


MickyG
01-07-2008, 05:15 AM
Hi

I would like a menu with two items: a drop down list and a button.

Is it possible to have the button.enabled status change dynamically depending on what is currently selected from the drop down list?

My blind searching has stumbled into Callbacks, is this what I should be looking into?

Thanks

Bobo
01-07-2008, 07:06 AM
Hi

I would like a menu with two items: a drop down list and a button.

Is it possible to have the button.enabled status change dynamically depending on what is currently selected from the drop down list?

My blind searching has stumbled into Callbacks, is this what I should be looking into?

Thanks

In the event handler ON someDropDownList SELECTED itm DO (), you can set the state of the button based on the 'itm' value which will contain the index of the selection.

For example,


rollout test_rollout "Test"
(
dropdownlist ddl_test items:#("One","Two")
button btn_test "Test Button" enabled:false

on ddl_test selected itm do
(
btn_test.enabled = itm == 2
)
on btn_test pressed do print ddl_test.selection
)--end rollout
createDialog test_rollout 120 60


If you meant something else, please clarify.

MickyG
01-07-2008, 09:39 PM
Thanks Bobo

I realised that if I want to call the button.enabled property outside the button pressed code, I have to first add the rollout name eg. rollout.button.enabled, not just button.enabled.

But your way also provides a working solution, so I will add it to my slowly-growing store of knowledge, with my thanks.

CGTalk Moderation
01-07-2008, 09:39 PM
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.