Khryus Posted October 25, 2014 Posted October 25, 2014 (edited) Hi, I'm currently writing a little program which will provide information for each anime which is in my collection, depending on which one you select. Information will be gathered via myanimelist.net API. At the moment I have 2 forms: Main form, which holds all informations about currently selected title, search "bar" and more Title selection form, which is supposed to pop up after making a search. You write in the main form your query (literally just type when the window is focused), then hit enter and the search starts. Once it's done I get back an XML file. For now I'm just counting the 'entry' tags inside it to determine how many titles I found, and if it's greater than 1, the "Title selection" form will show up. What happens is, after the search, if there are more than 1 entry tags (so titles found), the main window goes hidden (GUICtrlSetState(handle of main window, @SW_HIDE) which is OK), the Title Selection form shows up, but after I select a title, the window doesn't disappear (title selection form should disappear and main form should appear). Here is the part of the code which is giving problems (lines 141-151): $hTitleSelectionWindow = Title Selection Form $hWindow = Main Form $hTitleCombo = ComboBox inside Title Selection Form While 1 $msg = GUIGetMsg() ;quit when GUI receives close message, so escape or button to close window If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $hTitleOK Then ConsoleWrite("read: "&GUICtrlRead($hTitleCombo)&@CRLF) ;if user didn't pick anything If GUICtrlRead($hTitleCombo) == "" Then MsgBox(48, "Title selection", "Please pick a valid option.") Else GUISetState($hTitleSelectionWindow, @SW_HIDE) GUISetState($hWindow, @SW_SHOW) GUICtrlSetData($hTitleCombo, "") EndIf EndIf ;reset timer and "hide" label If $lastKeypress > 0 Then ;~ ConsoleWrite("time elapsed since last keypress: "&timeOfDay_Seconds() - $lastKeypress&@CRLF) If timeOfDay_Seconds() - $lastKeypress >= 3 Then $lastKeypress=0 GUICtrlSetData($hCurrentObjectLabel, "") EndIf EndIf Sleep(10) WEnd For some reason these 2 lines aren't working (or at least seem not to), GUISetState($hTitleSelectionWindow, @SW_HIDE) GUISetState($hWindow, @SW_SHOW) however the following line works. GUICtrlSetData($hTitleCombo, "") I have attached the whole script to this post (organized it slightly better and removed username and password for MAL's API) in case the code I posted isn't enough to determine the problem. EDIT: forgot to actually attach the file. Also forgot to >link to a required UDF Edited October 25, 2014 by Khryus "The story of a blade is linked in Blood." ―Yasuo
Solution Khryus Posted October 25, 2014 Author Solution Posted October 25, 2014 Sigh. Just figured out I switched the parameters in GUISetState. Sorry mods "The story of a blade is linked in Blood." ―Yasuo
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