Jump to content

Press X on subform witout closing out main script


Ivan808
 Share

Recommended Posts

Hello, I know this is probably a VERY small and simple script. I just cant find what I am looking for. I found Winclose in the help file and of course exit. But neither is what i am looking for.

I am trying to be able to have it where I can click the "X" at the top right hand of the window and it will not close out or exit the subform (maybe there is a way to make it where it Show.Hide it?). I have it where the main form is shown at all times, unless of course the user clicks on the "X" :)

Anyone know how to do this?

Ivan

Link to comment
Share on other sites

An AutoIt GUI doesn't close when you click "X". It just sends the $GUI_EVENT_CLOSE message to GuiGetMsg(). If your message loop doesn't do anything with that, then nothing happens when you click it. Find the part of your loop that looks like this:

$msg = GuiGetMsg()
Switch $msg
     Case $GUI_EVENT_CLOSE
          Exit
     Case $SomeOtherButton
          _DoSomethingElse()
EndSwitch

Just take out/change the action for $GUI_EVENT_CLOSE.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

An AutoIt GUI doesn't close when you click "X". It just sends the $GUI_EVENT_CLOSE message to GuiGetMsg(). If your message loop doesn't do anything with that, then nothing happens when you click it. Find the part of your loop that looks like this:

$msg = GuiGetMsg()
Switch $msg
     Case $GUI_EVENT_CLOSE
          Exit
     Case $SomeOtherButton
          _DoSomethingElse()
EndSwitch

Just take out/change the action for $GUI_EVENT_CLOSE.

:)

This is what I have:

Case -3
            Exit

so I should change this back to $GUI_EVENT_CLOSE huh?

-------------EDIT---------------

OUTSTANDING, it WORKS!

I did this for anyone interested:

Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE, $a)
            GUISetState(@SW_HIDE, $b)
            GUISetState(@SW_HIDE, $c)
            GUISetState(@SW_HIDE, $d)
            GUISetState(@SW_HIDE, $e)
            GUISetState(@SW_HIDE, $f)
            GUISetState(@SW_SHOW, $Main_script)

This event upon clicking the "X" at the top, will hide all subforms currently open and will make sure that the main form is shown.

Thanks again!

Edited by Ivan808
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...