DarkBoost Posted February 5, 2009 Share Posted February 5, 2009 I have created a very basic GUI with a button which displays a different label based on the user input however I am unsure how to clear the existing data when new data is to be displayed (see attachment). Any assistance would be greatly appreciated, thanks #include <GUIConstantsEx.au3> GUICreate("example", 200, 100) GUICtrlCreateLabel("Type => 1 or 2 <= for message", 10, 10) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $input = GUICtrlCreateInput("", 115, 71, 30, 20) $button = GUICtrlCreateButton("GO", 150, 70, 40, 22) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $button If GUICtrlRead($input) = "1" Then GUICtrlCreateLabel("1. Hello World", 10, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ElseIf GUICtrlRead($input) = "2" Then GUICtrlCreateLabel("2. Goodbye World", 10, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Zedna Posted February 5, 2009 Share Posted February 5, 2009 #include <GUIConstantsEx.au3> GUICreate("example", 200, 100) GUICtrlCreateLabel("Type => 1 or 2 <= for message", 10, 10) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $input = GUICtrlCreateInput("", 115, 71, 30, 20) $button = GUICtrlCreateButton("GO", 150, 70, 40, 22) $label = GUICtrlCreateLabel("", 10, 50, 150, 20) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $button $what = GUICtrlRead($input) If $what = "1" Then GUICtrlSetData($label, "1. Hello World") ElseIf $what = "2" Then GUICtrlSetData($label, "2. Goodbye World") EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
DarkBoost Posted February 5, 2009 Author Share Posted February 5, 2009 Ah of course, thanks for your assistance Zedna Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now