kaotkbliss Posted August 9, 2010 Share 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 Xandy 1 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 9, 2010 Share 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! Xandy, RickB75 and Netol 3 .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 Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 9, 2010 Author Share 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. Xandy 1 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! 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