Jump to content

popup window help please im new


hot202
 Share

Recommended Posts

ho how doi make a pop up window to work with my exit button so it asks if im sure i want to exit with yess ad no and also a popup if i click info button it shows my info and has a ok button closes that popupand retunes to the normal window thanks heaps guys if u can help me

Link to comment
Share on other sites

ho how doi make a pop up window to work with my exit button so it asks if im sure i want to exit with yess ad no and also a popup if i click info button it shows my info and has a ok button closes that popupand retunes to the normal window thanks heaps guys if u can help me

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>



GUICreate("My GUI") ; will create a dialog box that when displayed is centered
Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Info", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("Exit", 0, -1)
GUISetState(@SW_SHOW) ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Or $msg = $Button_2 Then
        If MsgBox(4, "YOU SURE", "") = 6 Then
            ExitLoop
        Else
            MsgBox('', '', 'You pressed no')
        EndIf
    EndIf
    If $msg = $Button_1 Then MsgBox('', 'You should always look in the help', 'FILE')
WEnd

GUIDelete()

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>



GUICreate("My GUI") ; will create a dialog box that when displayed is centered
Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Info", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("Exit", 0, -1)
GUISetState(@SW_SHOW) ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Or $msg = $Button_2 Then
        If MsgBox(4, "YOU SURE", "") = 6 Then
            ExitLoop
        Else
            MsgBox('', '', 'You pressed no')
        EndIf
    EndIf
    If $msg = $Button_1 Then MsgBox('', 'You should always look in the help', 'FILE')
WEnd

GUIDelete()

omg thankyou very much this has really helped. just 1 thing is there away to make 1 think with the info box that popsup can i make it a custom GUI box or it has to be a MsgBox?
Link to comment
Share on other sites

sorry4 the double post. Also where do i add my Case $otherbuttons?

im trying to do it but i get a autoit error. saying Case statement with no matching select or switch statement.

Edited by hot202
Link to comment
Share on other sites

sorry4 the double post. Also where do i add my Case $otherbuttons?

im trying to do it but i get a autoit error. saying Case statement with no matching select or switch statement.

And, er, um... did you find that someone had torn out the pages for Switch and Select from your help manual?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Have you talken the time to read my post?

Reread it and go to bed to sleep.

Come back when you are fresh and have put in some effort in trying things yourself.

Jos

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>



GUICreate("My GUI") ; will create a dialog box that when displayed is centered
Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Info", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("Exit", 0, -1)
$Button_3 = GUICtrlCreateButton("READ HELP", 0, -1)
$Button_4 = GUICtrlCreateButton("FILE", 0, -1)
GUISetState(@SW_SHOW) ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_2
            If MsgBox(4, "YOU SURE", "") = 6 Then
                ExitLoop
            Else
                MsgBox('', '', 'You pressed no')
            EndIf
        Case $msg = $Button_1
            MsgBox('', 'You should always look in the help', 'FILE')
        Case $msg = $Button_3
            Run("notepad.exe")
        Case $msg = $Button_4
            Run("CALC.exe")
            
    EndSelect
    
    
WEnd

GUIDelete()

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

lol im a noob haha sorry i needed my sleep. there is just 1 more thing how would i be able to do it with a child popup 4 the info so i can have more buttons on it like email and just some other stuff. thanks heaps guys.

Link to comment
Share on other sites

well this here is a very sloppy looking but working version of what you were asking for, commented to keep it simple and so you know what all is going on

#include <guiconstants.au3>
#include <windowsconstants.au3>
$main = guicreate("Main Gui",400,350); create the main gui
$menu1 = GUICtrlCreateMenu("Main Menu"); create the menu section
$about = GUICtrlCreateMenuItem("About",$menu1); menu item1
$exitt = GUICtrlCreateMenuItem("Exit",$menu1); menu item 2
$sub = GUICreate("Sub Gui",285,170,"","","","",$main); create the sub gui
GUICtrlCreateLabel("This is some text", 32, 16, 82, 17); add some text to the sub
$Butt = GUICtrlCreateButton("Button1", 72, 96, 145, 33); and a button to close it
GUISetState(@sw_hide,$sub); make sure the sub is hidden
GUISetState(@SW_SHOW,$main); show the main gui
while 1
    $msg = GUIGetMsg()
    Switch $msg
        case $gui_event_close
            Exit
        case $exitt; make the exit menu item function correctly
            Exit
        case $about; when the user clicks on the about menu item
            $zz = WinGetPos($main); get the position of the main gui's, gui
            WinMove($sub,"",$zz[0]+50,$zz[1]+100); move the sub so that it is 50 + x and 100 + y of the main gui
            guisetstate(@sw_disable,$main); disable the main gui, which gives focus to the sub
            guisetstate(@sw_show,$sub); show the sub
        case $butt; action that occures when you click the button on the sub gui
            guisetstate(@SW_ENABLE,$main); re-enable the main gui, must be before the below code or else the whole program will minimize :P
            guisetstate(@SW_HIDE,$sub); hide the sub
    EndSwitch
WEnd

also replace:

$sub = GUICreate("Sub Gui",285,170,"","","","",$main)

with:

$sub = GUICreate("Sub Gui",285,156,"","",bitor($ws_popup,$ws_border),"",$main)

if you would like a different style on the sub gui

Edited by Suirad
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...