Manticore Posted March 25, 2017 Posted March 25, 2017 I'm writing a soft where I have Parent GUI and Child GUI. I have an 2D array which contain 2 GUI element 1 is an InputField and 1 is a Check box. I want make it so that when ever I check the Box it will enable the InputField and vise versa This is part of the code that is not working Case $g_hLMenuFrm[0] Switch $aGUIMsg[0] ; Now check for the messages for $g_hLMenuFrm[0] Case $g_aSIDEItem[1][0] To $g_aSIDEItem[1][(UBound($g_aSIDEItem, 2) - 1)] For $r = 0 To UBound($g_aSIDEItem, 2) - 1 If $aGUIMsg[0] = $g_aSIDEItem[1][$r] Then _Enable($g_aSIDEItem[1][$r], $g_aSIDEItem[0][$r]) EndIf Next EndSwitch I dont know what am I doing wrong if I write each one out like this then it work: Case $g_hLMenuFrm[0] Switch $aGUIMsg[0] ; Now check for the messages for $g_hLMenuFrm[0] Case $aGUIMsg[0] = $g_aSIDEItem[1][0] _Enable($g_aSIDEItem[1][0], $g_aSIDEItem[0][0]) Case $aGUIMsg[0] = $g_aSIDEItem[1][1] _Enable($g_aSIDEItem[1][1], $g_aSIDEItem[0][1]) EndSwitch I know that I can do It this way Case $g_hLMenuFrm[0] For $r = 0 To UBound($g_aSIDEItem, 2) - 1 If $aGUIMsg[0] = $g_aSIDEItem[1][$r] Then _Enable($g_aSIDEItem[1][$r], $g_aSIDEItem[0][$r]) EndIf Next However, I want to know why the Switch Case is not working. I have no idea what I'm doing wrong if someone knows please guide me to a right direction thank you
Gianni Posted March 25, 2017 Posted March 25, 2017 what kind of data are contained in the array "$ g_aSIDEItem" ? Manticore 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Manticore Posted March 25, 2017 Author Posted March 25, 2017 @Chimp thank you for replying me after almost 8 hours i finally found my mistake. Turn out I have been viewing the array dimension wrong. I got it working now
Manticore Posted March 25, 2017 Author Posted March 25, 2017 However, Is there anyway to make this shorter? Func LMenuCheck($default, $menuN) For $i = 0 To UBound($g_aLMenu, 1) - 1 GUISetBkColor($COLOR_WHITE, $g_aLMenu[$i][1]) If $default Then If $i = $menuN Then setLMenuLblColor($g_aLMenu[$i][0], "Selected") GUISetState(@SW_SHOW, $g_aLMenu[$i][1]) GUICtrlSetState($g_cBtnBack, $GUI_HIDE) Else setLMenuLblColor($g_aLMenu[$i][0], "Default") GUISetState(@SW_HIDE, $g_aLMenu[$i][1]) EndIf Else setLMenuLblColor($g_aLMenu[$i][0], "Default") GUISetState(@SW_HIDE, $g_aLMenu[$i][1]) EndIf Next EndFunc ;==>LMenuCheck
spudw2k Posted March 30, 2017 Posted March 30, 2017 Perhaps this (untested)? Func LMenuCheck($default, $menuN) For $i = 0 To UBound($g_aLMenu, 1) - 1 GUISetBkColor($COLOR_WHITE, $g_aLMenu[$i][1]) If $default And $i = $menuN Then setLMenuLblColor($g_aLMenu[$i][0], "Selected") GUISetState(@SW_SHOW, $g_aLMenu[$i][1]) GUICtrlSetState($g_cBtnBack, $GUI_HIDE) Else setLMenuLblColor($g_aLMenu[$i][0], "Default") GUISetState(@SW_HIDE, $g_aLMenu[$i][1]) EndIf Next EndFunc ;==>LMenuCheck Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
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