Jump to content

GUISetState doesn't set state?

Go to solution Solved by Khryus,

Recommended Posts

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.")
            GUISetState($hTitleSelectionWindow, @SW_HIDE)
            GUISetState($hWindow, @SW_SHOW)
            GUICtrlSetData($hTitleCombo, "")

    ;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
            GUICtrlSetData($hCurrentObjectLabel, "")

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 by Khryus

"The story of a blade is linked in Blood." 



Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...