Close and opening a window inside the main window

BlitzMax Forums/BlitzMax Beginners Area/Close and opening a window inside the main window

Marco A G Pinto(Posted 2012) [#1]
Hello!!!

I am creating an utility and there are menu options inside the main window which open a window inside the main window with a text box and buttons.

To close this second window after user input I have tried disablegadget, freegadget and hidegadget and activate the main window.

But, if I try again to open this window, my utility hangs and I have to use task manager to close the application.

How should I code it?

Thanks!

Kind regards,
>Marco A.G.Pinto
--------------------


jsp(Posted 2012) [#2]
If you need the second window again and again, HideGadget is the best options.
If you need the it only for a certain dialog, FreeGadget is good.
DisableGadget only grays out the window and you are not able to select anything.

But as you said the problem is more with opening the window instead of closing.
When you open that window, how do you process the events from that window?
You need to check for the events of that window, or your WaitEvent() loop would be hang forever.


Marco A G Pinto(Posted 2012) [#3]
@jsp

Thanks for your help.

I found out that I had issues while creating the sub-window from inside functions or inside an IF and ENDIF.

I had to place the code in the main body of my utility but, the problem is that we see the window opening and closing (hidegadget) when we run my utility.

I was wondering if there is a command that opens the sub-window with its status as hidden so that it doesn't give a bad feeling of appearing on screen for almost a second.

Also, how do I place it in the middle of my utility's main window? It appears on the top left.

Thanks for your help.

Kind regards from,
>Marco A.G.Pinto
--------------------


jsp(Posted 2012) [#4]
Here is an example:

Checkout the child window which is created 'hidden' and it will place itself always in the middle of the MainWindow when it opens.