Jump to content

A Popup Gui problem


PPowerHouseK
 Share

Recommended Posts

Hell all,

I have been trying to figure out to how do this for a long time now. Basically I have a autoit script with a GUI. When a button is pushed, i need the GUI to open a new GUI that has a combo box and an okay button. I want the okay button to read the data from the combo box and return control back to the main gui. When the x button is pressed on the popup gui, it should close just that gui and not the main one as well. My problem is that i cannot get the Gui to read the input from the combo, close after okay is pressed or just close with the x. Here is the part of my main script where the second GUI should pop out.

Case $secondgui
    $who = GUICtrlRead($input)
    $secondgui=GUICreate("newgui",250, 250)
    GUISetState()
    $getffs=GUICtrlCreateCombo("Choice1",0, 0, 100)
    $rank=GUICtrlRead($getffs)
    $okay=GUICtrlCreateButton("Okay",50,50,-1)
Switch GUIGetMsg()
        Case $okay
                WinActivate("window")
                Send("{ESC}")
                sleep(500)
                Send("t")
                sleep(300)
                Send("$who & $rank2)
                Send("{Enter}")


EndSwitch

Any help would be greatly appreciated.

Link to comment
Share on other sites

I hope this will help you:

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GUIEdit.au3>
#include <StaticConstants.au3>

$hGUI = GUICreate("Main GUI",500,400);Create main GUI
$hButton1 = GUICtrlCreateButton("Open 2nd GUI!!",20,20, 100,20)
$hLabel1 = GUICtrlCreateLabel("",20, 50, 100,20);Create label where the result is displayed
GUISetState()

$hGUI2 = GUICreate("Popup GUI", 200, 200);Create POPUP GUI
$hButtonX = GUICtrlCreateButton("X",20,20,25,25);Create X button
$hCombo = GUICtrlCreateCombo("",20,50, 100, 20);Create Combo
GUICtrlSetData($hCombo, "Data1|Data2|Data3");Set data of combo

GUISetState(@SW_HIDE, $hGUI2)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton1
            GUISetState(@SW_SHOW, $hGUI2)
        Case $hButtonX
            $result = GUICtrlRead($hCombo)
            GUICtrlSetData($hLabel1, $result)
            GUISetState(@SW_HIDE, $hGUI2)
    EndSwitch
WEnd
PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
Link to comment
Share on other sites

  • Moderators

PPowerHouseK,

When the x button is pressed on the popup gui, it should close just that gui and not the main one as well.

I recommend the Managing Multiple GUIs tutorial in the Wiki - it shows you how to avoid that particular problem. And it might well help you with the others as well ;)

After having read the tutorial please come back if you have any further questions. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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