dash007 Posted February 17, 2006 Share Posted February 17, 2006 Hi all, Below is my code example. When you run the code, it will search the first entry in the inifile (movies.ini) and show that in the input box. When you click the 'Check' button it will show the corresponding value (found in the movies.ini) and paste this in the GUI. So far so good. What I don't know is how can I enable the 'NEXT' button such that when I click on it, it will search the ini and get the entry that is immediately following the entry that is already in the GUI (Input1). For example, I have 'Monday' on the GUI when the GUI is launched. This is because 'Monday' is the first entry in the ini. When I click on 'NEXT' I want 'Tuesday' to populate the Input1 field (as Tuesday is the next entry in the ini). #include <GUIConstants.au3> ; == GUI generated with Koda == $Form1 = GUICreate("What2See", 338, 206, 192, 125) $Check = GUICtrlCreateButton("Check", 64, 168, 85, 25) $Next = GUICtrlCreateButton("Next", 192, 168, 85, 25) $Input1 = GUICtrlCreateInput("", 72, 24, 193, 21, -1, $WS_EX_CLIENTEDGE) $Edit1 = GUICtrlCreateEdit("", 40, 64, 265, 89, -1, $WS_EX_CLIENTEDGE) $var = IniReadSection("movies.ini", "Movies") If @error Then MsgBox(4096, "", "Error occured, probably no INI file.") Else For $i = 1 To $var[0][0] GUICtrlSetData($Input1,$var[1][0]) Next EndIf GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Check GUICtrlSetData($Edit1, IniRead("movies.ini", "Movies",GUICtrlRead($Input1),"No File")) Case $msg = $Next ;"xxxxxxxxxxxxxx HELP NEEDED HERE xxxxxxxxxxxxxxx" EndSelect WEnd Exit The inifile is below (please name it movies.ini and place in same directory as script): [Movies] Monday=Will & Grace, Simpsons, Friends Tuesday=Lost, Revelations Wednesday=SouthPark, CSI Thursday=Friends, Travel Friday=Movie, Simpsons Saturday=Soccer Sunday=Friends Other (DVD etc)=Madagaskar Can somebody shed some light on this please.... Thanks in advance Link to comment Share on other sites More sharing options...
Nuffilein805 Posted February 17, 2006 Share Posted February 17, 2006 (edited) what are you doing? #include <GUIConstants.au3> ; == GUI generated with Koda == $Form1 = GUICreate("What2See", 338, 206, 192, 125) $Check = GUICtrlCreateButton("Check", 64, 168, 85, 25) $Next = GUICtrlCreateButton("Next", 192, 168, 85, 25) $Input1 = GUICtrlCreateInput("", 72, 24, 193, 21, -1, $WS_EX_CLIENTEDGE) $Edit1 = GUICtrlCreateEdit("", 40, 64, 265, 89, -1, $WS_EX_CLIENTEDGE) $var = IniReadSection("movies.ini", "Movies") If @error Then MsgBox(4096, "", "Error occured, probably no INI file.") Else $i = 1 GUICtrlSetData($Input1,$var[$i][0]) EndIf GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Check GUICtrlSetData($Edit1, $var[$i][1]) Case $msg = $Next $i = $i + 1 if $i > 8 then $i = $i - 8 guictrlsetdata ($input1, $var[$i][0]) guictrlsetdata ($edit1, $var[$i][1]) EndSelect WEnd Exit this should work edit: didn't realize you had "others" Edited February 17, 2006 by Nuffilein805 my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
dash007 Posted February 17, 2006 Author Share Posted February 17, 2006 Hi Nuffilein805, Thanks for the idea and script I have modified it slightly (taken off the "Check" button and also modified it to loop based on the number of entries in the ini rather than hardcode the value of '8'). This is incase I decide to add any additional entries into the ini The new code (if anyone is interested) is: #include <GUIConstants.au3> ; == GUI generated with Koda == $Form1 = GUICreate("What2See", 338, 206) $Next = GUICtrlCreateButton("Next", 126, 168, 85, 25) $Input1 = GUICtrlCreateInput("", 72, 24, 193, 21, -1, $WS_EX_CLIENTEDGE) $Edit1 = GUICtrlCreateEdit("", 40, 64, 265, 89, -1, $WS_EX_CLIENTEDGE) $var = IniReadSection("movies.ini", "Movies") If @error Then MsgBox(4096, "", "Error occured, probably no INI file.") Else $i = 1 GUICtrlSetData($Input1,$var[$i][0]) GUICtrlSetData($Edit1, $var[$i][1]) EndIf GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Next guictrlsetdata ($edit1, "") $i = $i + 1 if $i > $var[0][0] then $i = $i - $var[0][0] guictrlsetdata ($input1, $var[$i][0]) GUICtrlSetData($Edit1, $var[$i][1]) EndSelect WEnd Exit 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