Sign in to follow this  
Followers 0
VicTT

Code bit

2 posts in this topic

GUICreate("Sender",500,300)
$check_sender=GUICtrlCreateCheckbox("Randomize sender",0,0)
$check_data=GUICtrlCreateCheckbox("Randomize data",0,40)
$input_sender=GUICtrlCreateInput("sender@yahoo.com",0,20,150)
$input_data=GUICtrlCreateEdit("Message",0,60,150,240)
GUISetState(@SW_SHOW)

;MAIN LOOP

while 1
$msg=GUIGetMsg()
Select
Case $msg=$GUI_EVENT_CLOSE
ExitLoop
Case $msg=$check_sender
if GUICtrlGetState($check_sender)=$GUI_CHECKED then GUICtrlSetState($input_sender,$GUI_DISABLE)
if GUICtrlGetState($check_sender)=$GUI_UNCHECKED then GUICtrlSetState($input_sender,$GUI_ENABLE)
Endselect
Wend

This is supposed to be "the beginning of a wonderful GUI" but..Something is wrong..When I click the $check_sender box, GUIGetMsg() notices I clicked it, but nothing happens..how do I place the if's?The incput box doesn't get disabled/enabled..any ideas?Thanks..


[quote]Together we might liveDivided we must fall[/quote]

Share this post


Link to post
Share on other sites



GUICreate("Sender",500,300)
$check_sender=GUICtrlCreateCheckbox("Randomize sender",0,0)
$check_data=GUICtrlCreateCheckbox("Randomize data",0,40)
$input_sender=GUICtrlCreateInput("sender@yahoo.com",0,20,150)
$input_data=GUICtrlCreateEdit("Message",0,60,150,240)
GUISetState(@SW_SHOW)

;MAIN LOOP

while 1
$msg=GUIGetMsg()
Select
Case $msg=$GUI_EVENT_CLOSE
ExitLoop
Case $msg=$check_sender
if GUICtrlGetState($check_sender)=$GUI_CHECKED then GUICtrlSetState($input_sender,$GUI_DISABLE)
if GUICtrlGetState($check_sender)=$GUI_UNCHECKED then GUICtrlSetState($input_sender,$GUI_ENABLE)
Endselect
Wend

This is supposed to be "the beginning of a wonderful GUI" but..Something is wrong..When I click the $check_sender box, GUIGetMsg() notices I clicked it, but nothing happens..how do I place the if's?The incput box doesn't get disabled/enabled..any ideas?Thanks..

<{POST_SNAPBACK}>

You need to do a GUICtrlRead instedof a GUICtrlGetState

Then the script will work :)

UICreate("Sender",500,300)
$check_sender=GUICtrlCreateCheckbox("Randomize sender",0,0)
$check_data=GUICtrlCreateCheckbox("Randomize data",0,40)
$input_sender=GUICtrlCreateInput("sender@yahoo.com",0,20,150)
$input_data=GUICtrlCreateEdit("Message",0,60,150,240)
GUISetState(@SW_SHOW)

;MAIN LOOP

while 1
$msg=GUIGetMsg()
Select
Case $msg=$GUI_EVENT_CLOSE
ExitLoop
Case $msg=$check_sender
if GUICtrlRead($check_sender)=$GUI_CHECKED then GUICtrlSetState($input_sender,$GUI_DISABLE)
if GUICtrlRead($check_sender)=$GUI_UNCHECKED then GUICtrlSetState($input_sender,$GUI_ENABLE)
Endselect
Wend

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0