Jump to content

How to create a popup/child window


Holger
 Share

Recommended Posts

Hi :ph34r:

I couldn't find an answer in the www, so here is my question.

How can I create something like a child/popup window who's parent window is not accessible for the time the child is open?

You know this window from the most programs:

You click in the menu "?" and then maybe the "Info" or "About"-item.

Then this window appears and if you want to click behind it then only a beep happens and the window flashes a little bit.

So you come to the parent back only after closing this info-window.

How can I create such a child window with the new multi-GUI-functions?

If you have an idea then let me know.

Thanks and regards :(

Holger

Edited by Holger
Link to comment
Share on other sites

  • Administrators

I was sure we had an option for enabling/disabling windows (even in the normal AutoIt Win... funcs) but...er...seems not to be there. I'll have a play around.

We definately can't do proper modal windows as that requires a new message loop and stopping the existing loop which won't work in AutoIt, but I'll see how the disabling approach works.

Link to comment
Share on other sites

  • Administrators

Updated the unstable.

Added two new macros @SW_ENABLE and @SW_DISABLE which can be used in:

GuiSetState()

WinSetState()

To simulate a modal "about" box just display the about box and then GuiSetState(@SW_DISABLE) the parent. When the about box is closed do GuiSetState(@SW_ENABLE)

Link to comment
Share on other sites

Great and thanks :)

Here is my small example if anyone wants to test it :)

#include "GUIConstants.au3"

$parentgui = GUICreate("Parent",400,300)
GUISetState(@SW_SHOW)

$childgui = GUICreate("Child",340,120,-1,-1,BitOr($WS_POPUP,$WS_CAPTION,$WS_SYSMENU),-1,$parentgui)
GUISetState(@SW_SHOW)
GUISwitch($parentgui)
GUISetState(@SW_DISABLE)

While 1
    $msg = GUIGetMsg(1)

    $ctrlmsg = $msg[0]
    $win = $msg[1]
    $posx = $msg[3]
    $posy = $msg[4]
   
    Select
        Case $ctrlmsg = $GUI_EVENT_CLOSE And $win = $parentgui
            ExitLoop
        Case $ctrlmsg = $GUI_EVENT_CLOSE And $win = $childgui
         GUISwitch($parentgui)
            GUISetState(@SW_ENABLE)
         GUISwitch($childgui)
         GUISetState(@SW_HIDE)
    EndSelect
WEnd

GUIDelete()

Exit

Holger

Link to comment
Share on other sites

  • 11 months later...

All,

I am facing a somewhat similar problem when using IE.au3 file. I am trying to create an automated script that submits a form. However when I click on a particular link it opens up a modal dialog box that contains another form. I need to be able to select a value in this form and then close the dialog box. Do you know how I can get a reference to this dialog box?

Link to comment
Share on other sites

This specific issue is being discussed in another thread here.

Unfortunately, getting the window reference is very different than getting a COM object reference.

I suggest you watch the other thread to see what develops.

Dale

All,

I am facing a somewhat similar problem when using IE.au3 file. I am trying to create an automated script that submits a form. However when I click on a particular link it opens up a modal dialog box that contains another form. I need to be able to select a value in this form and then close the dialog box. Do you know how I can get a reference to this dialog box?

<{POST_SNAPBACK}>

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...