Komawoyo Posted January 2, 2008 Posted January 2, 2008 Hi, im trying to set a certain button to load up as disabled. The problem is that i cant get the "Button" to be disabled accordingly to the Ini file. heres a simple code to help you understand what im trying to do. #include <GUIConstants.au3> $Form = GUICreate("Testing", 150, 66, 400, 308) $Button1 = GUICtrlCreateButton("1", 16, 16, 49, 33, 0) $Button2 = GUICtrlCreateButton("2", 85, 15, 49, 33, 0) GUISetState(@SW_SHOW) If IniRead(@ScriptDir&"\Settings.Ini", "General", "LoadList", "") <> "" Then GUICtrlSetState("$Button"&IniRead(@ScriptDir&"\Settings.Ini", "General", "LoadList", ""), $GUI_DISABLE) Else GUICtrlSetState($Button1, $GUI_DISABLE) IniWrite(@ScriptDir&"\Settings.Ini", "General", "LoadList", "1") EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetState($Button1, $GUI_DISABLE) GUICtrlSetState($Button2, $GUI_ENABLE) IniWrite(@ScriptDir&"\Settings.Ini", "General", "LoadList", "1") Case $Button2 GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Button2, $GUI_DISABLE) IniWrite(@ScriptDir&"\Settings.Ini", "General", "LoadList", "2") EndSwitch WEnd
goldenix Posted January 2, 2008 Posted January 2, 2008 (edited) #include <GUIConstants.au3> $Form = GUICreate("Testing", 150, 66, 400, 308) $Button1 = GUICtrlCreateButton("1", 16, 16, 49, 33, 0) $iread = IniRead(@ScriptDir&"\Settings.Ini", "General", "LoadList", "") If $iread <> "" Then GUICtrlSetState($Button1,$GUI_DISABLE) GUISetState(@SW_SHOW) ; you disable button before you make the Gui Visible! Notice that! While 1 Sleep(100) WEnd Btw check the Help file next time, there is 1 nice example Edited January 2, 2008 by goldenix My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
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