kaotkbliss 146 Posted August 9, 2010 I'm trying to save the current active tab to an ini, then later when the gui is redrawn, set the active tab to what was saved in the ini but I can't seem to figure it out. #include <GUIConstantsEx.au3> Global $htab, $curtab $1 = InputBox("Enter Tab 1 Name", "Enter a Name for Tab 1", "Tab1") $2 = InputBox("Enter Tab 2 Name", "Enter a Name for Tab 2", "Tab2") $3 = InputBox("Enter Tab 3 Name", "Enter a Name for Tab 3", "Tab3") IniWrite(@WorkingDir & "\pldata.ini", "Tab", 1, $1) IniWrite(@WorkingDir & "\pldata.ini", "Tab", 2, $2) IniWrite(@WorkingDir & "\pldata.ini", "Tab", 3, $3) $tab1 = IniRead(@WorkingDir & "\pldata.ini", "Tab", 1, "Tab1") $tab2 = IniRead(@WorkingDir & "\pldata.ini", "Tab", 2, "Tab2") $tab3 = IniRead(@WorkingDir & "\pldata.ini", "Tab", 3, "Tab3") $curtab=IniRead(@WorkingDir & "\pldata.ini","curtab",1,$tab1) $main = GUICreate("Program Launcher", 350, 446, -1, -1) $htab=GUICtrlCreateTab(2, 2, 346, 426) $win = GUICtrlCreateTabItem($tab1) $win2 = GUICtrlCreateTabItem($tab2) $win3 = GUICtrlCreateTabItem($tab3) GUICtrlCreateTabItem("") GUISwitch ($main, $curtab) GUISetState(@SW_SHOW) While 1 $msg=GUIGetMsg() If $msg=$GUI_EVENT_CLOSE Then $curtab=GUICtrlRead($htab) IniWrite(@WorkingDir & "\pldata.ini","curtab",1,$curtab) GUIDelete() Exit (1) EndIf WEnd 1 Xandy reacted to this 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites
AdmiralAlkex 125 Posted August 9, 2010 1. Your current way doesn't even work in theory. GUISwitch() needs a control id, and you give it the index. You should have set the advanced parameter of GUICtrlRead(). See GUISwitch(), GUICtrlCreateTabItem() and GUICtrlRead() in the helpfile. 2. Read the page for GUICtrlCreateTabItem() in the helpfile again. Notice the second remark? To select a specific tabitem to be shown when the dialog box open just issue a GUICtrlSetState(-1,$GUI_SHOW) see example. So to fix you script, change to: GUICtrlCreateTabItem("") GUICtrlSetState($curtab, $GUI_SHOW) GUISetState(@SW_SHOW) And voila! 2 RickB75 and Xandy reacted to this .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Share this post Link to post Share on other sites
kaotkbliss 146 Posted August 9, 2010 Thank you much! I figured there was an easy way, I was so busy looking for a function, I missed the additional parameters. 1 Xandy reacted to this 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites