Potarski Posted February 16, 2011 Share Posted February 16, 2011 (edited) I made a manu in my gui but i have small question, how to make if i click on settings(GUICtrlCreateMenuItem) then it show me a lot of my inputs and buttons, and if i click for settings2(GUICtrlCreateMenuItem) them show me other settings. I tested GuiCtrlDelete but not working good... $hMAIN_WINDOW = GUICreate ("Test",363, 156, 800 / 2, 800 / 2) $aMENUID[0] = GUICtrlCreateMenu ('Menu') $aMENUID[1] = GUICtrlCreateMenuItem ('delete input' & @TAB & @TAB & '[F5]',$aMENUID[0]) $aMENUID[2] = GUICtrlCreateMenuItem ('show input' & @TAB & @TAB & '(requires restart)',$aMENUID[0]) $aMENUID[3] = GUICtrlCreateMenuItem ('read Input' & @TAB & @TAB & '(requires restart)',$aMENUID[0]) $aMENUID[9] = GUICtrlCreateMenuItem ('EXIT' & @TAB & @TAB & '[ESC]',$aMENUID[0]) GUISetState (@SW_SHOW,$hMAIN_WINDOW) While 1 $hMAIN_WINDOW = GUIGetMsg() Switch $hMAIN_WINDOW Case $GUI_EVENT_CLOSE Exit Case $aMENUID[2] $TEST = GUICtrlCreateButton("xxx", 0, 0, 29, 25, $WS_GROUP) Case $aMENUID[1] GUICtrlDelete($TEST) Case $aMENUID[3] MsgBox(64,"Reading...",GUICtrlRead($TEST)) EndSwitch WEnd I need example: I click Test then show me some option boxes etc if i click Test2 then show me others settings etc. If i buse GuiDelete then GUICtrlRead($TEST) doesn't working show "0" before delete show good "xxx". Edited February 16, 2011 by Potarski Link to comment Share on other sites More sharing options...
DarkBoost Posted February 16, 2011 Share Posted February 16, 2011 If I understood your question correctly you are trying to achieve something like this? expandcollapse popup#include <GUIConstantsEx.au3> Global $hMAIN_WINDOW, $hMAIN_MSG, $aMENUID[6], $TEST $hMAIN_WINDOW = GUICreate ("Test",363, 156, 800 / 2, 800 / 2) $aMENUID[0] = GUICtrlCreateMenu ('Menu') $aMENUID[1] = GUICtrlCreateMenuItem ('delete input' & @TAB & @TAB & '[F5]',$aMENUID[0]) $aMENUID[2] = GUICtrlCreateMenuItem ('show input' & @TAB & @TAB & '(requires restart)',$aMENUID[0]) $aMENUID[3] = GUICtrlCreateMenuItem ('read Input' & @TAB & @TAB & '(requires restart)',$aMENUID[0]) $aMENUID[4] = GUICtrlCreateMenuItem ('EXIT' & @TAB & @TAB & '[ESC]',$aMENUID[0]) GUISetState() While 1 $hMAIN_MSG = GUIGetMsg() Switch $hMAIN_MSG Case $GUI_EVENT_CLOSE _aMENUID4() Case $aMENUID[2] _aMENUID2() Case $aMENUID[1] _aMENUID1() Case $aMENUID[3] _aMENUID3() Case $aMENUID[4] _aMENUID4() EndSwitch WEnd Func _aMENUID2() MsgBox(0, "", "Button: aMENUID[2] - show input") EndFunc ;==> MenuID 2 Func _aMENUID1() MsgBox(0, "", "Button: aMENUID[1] - delete input") EndFunc ;==> MenuID 1 Func _aMENUID3() MsgBox(0, "", "Button: aMENUID[3] - read input") EndFunc ;==> MenuID 2 Func _aMENUID4() Exit EndFunc ;==> MenuID 4 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2011 Moderators Share Posted February 16, 2011 Potarski,A hint towards a rather more elegant solution - create all the controls just once and then Hide/Show them as required: #include <GUIConstantsEx.au3> Global $aMENUID[10] $hMAIN_WINDOW = GUICreate("Test", 363, 156, 800 / 2, 800 / 2) $aMENUID[0] = GUICtrlCreateMenu('Menu') $aMENUID[1] = GUICtrlCreateMenuItem('delete input' & @TAB & @TAB & '[F5]', $aMENUID[0]) $aMENUID[2] = GUICtrlCreateMenuItem('show input' & @TAB & @TAB & '(requires restart)', $aMENUID[0]) $aMENUID[3] = GUICtrlCreateMenuItem('read Input' & @TAB & @TAB & '(requires restart)', $aMENUID[0]) $aMENUID[9] = GUICtrlCreateMenuItem('EXIT' & @TAB & @TAB & '[ESC]', $aMENUID[0]) $TEST = GUICtrlCreateInput("xxx", 10, 10, 45, 25) ; create input just once GUICtrlSetState($TEST, $GUI_HIDE) ; and hide it GUISetState(@SW_SHOW, $hMAIN_WINDOW) While 1 Switch GUIGetMsg() ; Use the result directly - certainly do NOT overwrite the GUI handle variable Case $GUI_EVENT_CLOSE, $aMENUID[9] ; Add menu exit item here Exit Case $aMENUID[2] GUICtrlSetState($TEST, $GUI_SHOW) ; Show input Case $aMENUID[1] GUICtrlSetState($TEST, $GUI_HIDE) ; Hide input Case $aMENUID[3] MsgBox(64, "Reading...", GUICtrlRead($TEST)) EndSwitch WEndA couple of other points:- 1. You were overwriting the GUI handle when you tested for messages with GUIGetMsg - not a good idea! - 2. You can have a number of Case options in a single case - note how I added the Exit menu item to the Exit Case. - 3. You certainly do not require a restart to Hide/Show controls! All clear? Please ask again if not. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Potarski Posted February 16, 2011 Author Share Posted February 16, 2011 Thx very much ppl Please lock topic 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