Jump to content
Sign in to follow this  
beanwi

setting GUI to show up where the mouse cursor is

Recommended Posts

beanwi

I'm trying to set my 3rd GUI (File GUI) to show up where the mouse is when the @SW_Show command is in...

;Including Necessary Files
#include <WindowsConstants.au3>

;Creating GUIs,Styles, snd Buttons
;Main GUI
$Main_GUI = GUICreate("TIMMY", 400, 400)
GUISetStyle($WS_Caption)
$FileButton = GUICtrlCreateButton("File", 1, 1, 60, 20)
$HelpButton = GUICtrlCreateButton("HELP FILE", 61, 1, 60, 20)
$ExitButton = GUICtrlCreateButton("Exit", 121, 1, 60, 20)
GUISetState()
;Help GUI
$Help_GUI = GUICreate("2ndwindow", 200, 200)
GUISetStyle($WS_Caption)
$HelpExitButton = GUICtrlCreateButton("Exit", 1, 1, 60, 20)
GUISetState(@SW_HIDE, $Help_GUI)
;File GUI
$File_GUI = GUICreate("",250,200, MouseGetPos[1],MouseGetPos[0])
GUISetStyle($WS_Border)
GUISetState(@SW_Hide)

;Setting Button Parameters
While 1
    $Msg = GUIGetMsg()
        Select
            Case $Msg = $FileButton
                GUISetState(@SW_Show, $File_GuI)
            Case $Msg = $HelpButton
                GUISetState(@SW_SHOW, $Help_GUI)
            Case $Msg = $HelpExitButton
                GUISetState(@SW_HIDE, $Help_GUI)
            Case $Msg = $ExitButton
                ExitLoop
        EndSelect
WEnd

;Closing Statement
MsgBox(0, "Thank You", "Thank you for playing")

but it just shows up where the cursor was before the code started...and i dont know how to set a variable for a window that has already been created

Share this post


Link to post
Share on other sites
Valuater

;Including Necessary Files
#include <WindowsConstants.au3>

;Creating GUIs,Styles, snd Buttons
;Main GUI
$Main_GUI = GUICreate("TIMMY", 400, 400)
GUISetStyle($WS_Caption)
$FileButton = GUICtrlCreateButton("File", 1, 1, 60, 20)
$HelpButton = GUICtrlCreateButton("HELP FILE", 61, 1, 60, 20)
$ExitButton = GUICtrlCreateButton("Exit", 121, 1, 60, 20)
GUISetState()
;Help GUI
$Help_GUI = GUICreate("2ndwindow", 200, 200)
GUISetStyle($WS_Caption)
$HelpExitButton = GUICtrlCreateButton("Exit", 1, 1, 60, 20)
GUISetState(@SW_HIDE, $Help_GUI)
;File GUI
$Pos = MouseGetPos()
$File_GUI = GUICreate("", 250, 200, $Pos[0], $Pos[1])
GUISetStyle($WS_Border)
GUISetState(@SW_HIDE)

;Setting Button Parameters
While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $FileButton
            $Pos = MouseGetPos()
            WinMove( $File_GUI, "", $Pos[0], $Pos[1])
            GUISetState(@SW_SHOW, $File_GUI)
        Case $Msg = $HelpButton
            GUISetState(@SW_SHOW, $Help_GUI)
        Case $Msg = $HelpExitButton
            GUISetState(@SW_HIDE, $Help_GUI)
        Case $Msg = $ExitButton
            ExitLoop
    EndSelect
WEnd

;Closing Statement
MsgBox(0, "Thank You", "Thank you for playing")

EDIT:... Fixed minor error

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
beanwi

;Including Necessary Files
#include <WindowsConstants.au3>

;Creating GUIs,Styles, snd Buttons
;Main GUI
$Main_GUI = GUICreate("TIMMY", 400, 400)
GUISetStyle($WS_Caption)
$FileButton = GUICtrlCreateButton("File", 1, 1, 60, 20)
$HelpButton = GUICtrlCreateButton("HELP FILE", 61, 1, 60, 20)
$ExitButton = GUICtrlCreateButton("Exit", 121, 1, 60, 20)
GUISetState()
;Help GUI
$Help_GUI = GUICreate("2ndwindow", 200, 200)
GUISetStyle($WS_Caption)
$HelpExitButton = GUICtrlCreateButton("Exit", 1, 1, 60, 20)
GUISetState(@SW_HIDE, $Help_GUI)
;File GUI
$Pos = MouseGetPos()
$File_GUI = GUICreate("", 250, 200, $Pos[0], $Pos[1])
GUISetStyle($WS_Border)
GUISetState(@SW_HIDE)

;Setting Button Parameters
While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $FileButton
            $Pos = MouseGetPos()
            WinMove( $File_GUI, "", $Pos[0], $Pos[1])
            GUISetState(@SW_SHOW, $File_GUI)
        Case $Msg = $HelpButton
            GUISetState(@SW_SHOW, $Help_GUI)
        Case $Msg = $HelpExitButton
            GUISetState(@SW_HIDE, $Help_GUI)
        Case $Msg = $ExitButton
            ExitLoop
    EndSelect
WEnd

;Closing Statement
MsgBox(0, "Thank You", "Thank you for playing")

EDIT:... Fixed minor error

8)

Wow thanks a whole bunch, everyone on this forum is so helpful :)

i needa take a better look around the help file,...i can never seem to find the right commands, thanks tho :)

Share this post


Link to post
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
Sign in to follow this  

×