Jump to content

Opening Multiple GUI Windows


Danjen
 Share

Recommended Posts

Hello world, I'm new to AutoIt. *waves hello*

... And coming from a crappy OO-language like Turing is a welcome break.

Anyways, I'm having a little issue with opening up a GUI window from inside another one. Just a little macroing application I'm making, but I want it so that I can make a 'more interactive' window when I hit 'help -> about' than the MsgBox function apparently provides. Oh, and another thing is having my defined TIME() function update once per second. I'm not sure how to go about doing this, since if I put it in the While loop, it updates like 20 times a second.

#include <GuiConstants.au3>

;;Functions
func TIME();Gets the time and date.
    if @HOUR > 12 then
        $hour = @HOUR-12
        $AMPM = "PM"
    else
        $hour = @HOUR
        $AMPM = "AM"
    endif
    $embosstimeanddate = GUICtrlCreateLabel ($hour & ":" & @MIN & ":" & @SEC & " " & $AMPM,0,315,310,16,$SS_SUNKEN)
EndFunc

;Main Creation
$window1 = GUICreate("Main Window",310,350,-1,-1,BitOr($WS_CAPTION,$WS_SYSMENU))
$emboss1 = GUICtrlCreateLabel ("",0,0,310,2,$SS_SUNKEN)
$emboss2 = GUICtrlCreateLabel ("",0,3,310,84,$SS_SUNKEN)
$emboss3 = GUICtrlCreateLabel ("",0,3,310,84,$SS_SUNKEN)

;Menubar
$filemenu = GUICtrlCreateMenu("&File")
$fileitem1 = GUICtrlCreateMenuItem("E&xit",$filemenu)
$helpmenu = GUICtrlCreateMenu("&Help")  
$helpitem1 = GUICtrlCreateMenuItem("&Help",$helpmenu)
$helpitem2 = GUICtrlCreateMenuItem("",$helpmenu)
$helpitem3 = GUICtrlCreateMenuItem("&About",$helpmenu)

;Required Loop
GuiSetState()
TIME()
While 1
    $msg = GUIGetMsg()
    if $msg = $helpitem3 Then
        ???
        endif
    if $msg = $fileitem1 or $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
Exit
Edited by Larry
Link to comment
Share on other sites

Hello world, I'm new to AutoIt. *waves hello*

... And coming from a crappy OO-language like Turing is a welcome break.

Anyways, I'm having a little issue with opening up a GUI window from inside another one. Just a little macroing application I'm making, but I want it so that I can make a 'more interactive' window when I hit 'help -> about' than the MsgBox function apparently provides. Oh, and another thing is having my defined TIME() function update once per second. I'm not sure how to go about doing this, since if I put it in the While loop, it updates like 20 times a second.

#include <GuiConstants.au3>

;;Functions
func TIME();Gets the time and date.
    if @HOUR > 12 then
        $hour = @HOUR-12
        $AMPM = "PM"
    else
        $hour = @HOUR
        $AMPM = "AM"
    endif
    $embosstimeanddate = GUICtrlCreateLabel ($hour & ":" & @MIN & ":" & @SEC & " " & $AMPM,0,315,310,16,$SS_SUNKEN)
EndFunc

;Main Creation
$window1 = GUICreate("Main Window",310,350,-1,-1,BitOr($WS_CAPTION,$WS_SYSMENU))
$emboss1 = GUICtrlCreateLabel ("",0,0,310,2,$SS_SUNKEN)
$emboss2 = GUICtrlCreateLabel ("",0,3,310,84,$SS_SUNKEN)
$emboss3 = GUICtrlCreateLabel ("",0,3,310,84,$SS_SUNKEN)

;Menubar
$filemenu = GUICtrlCreateMenu("&File")
$fileitem1 = GUICtrlCreateMenuItem("E&xit",$filemenu)
$helpmenu = GUICtrlCreateMenu("&Help")  
$helpitem1 = GUICtrlCreateMenuItem("&Help",$helpmenu)
$helpitem2 = GUICtrlCreateMenuItem("",$helpmenu)
$helpitem3 = GUICtrlCreateMenuItem("&About",$helpmenu)

;Required Loop
GuiSetState()
TIME()
While 1
    $msg = GUIGetMsg()
    if $msg = $helpitem3 Then
        ???
        endif
    if $msg = $fileitem1 or $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
Exit
Edited by Larry
[u]You can download my projects at:[/u] Pulsar Software
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...