Jump to content

Recommended Posts

Posted (edited)

I'm completely baffled by this one, but I'm obviously a beginner, so I hope you'll be tolerant. I've written this GUI, and the two buttons respond when you press Enter or Esc, but I can't make the buttons respond to mouse clicks. What obvious error am I making here? Many thanks for any help.

#include <GUIConstantsEx.au3>
#include <FontConstants.au3>
#include <StaticConstants.au3>

$guiText = "This program lets you specify the exact position on screen (and on a " & _
    "specific monitor in a multi-monitor setup) for vDosWP." & @CRLF

$guiText2 = "The program creates a text file named ScreenPos.txt in your configuration folder. That file is used by the " & _
    "vDosWP launcher program to set the position of the vDosWP window." & @CRLF

$guiText3 = "Move the vDosWP window to the location you prefer. This program will create the ScreenPos.txt " & _
    "file when you click OK." & @CRLF

Const $sFont = "Calibri"
$hGUI = GUICreate("Set vDos Screen Position", 700, 250, 10, 10)
GUICtrlCreateLabel($guiText, 10, 10, 670, 100)
GUICtrlSetFont(-1, 14, $FW_NORMAL,  0 , $sFont, 5) ; Set the font of the previous control.
GUICtrlCreateLabel($guiText2, 10, 80, 670, 100)
GUICtrlSetFont(-1, 14, $FW_NORMAL,  0 , $sFont, 5) ; Set the font of the previous control.
GUICtrlCreateLabel($guiText3, 10, 150, 670, 100)
GUICtrlSetFont(-1, 14, $FW_NORMAL,  0 , $sFont, 5) ; Set the font of the previous control.
$iOKButton = GUICtrlCreateButton("OK", 550, 210, 60, 30, $SS_CENTER)
$iCancelButton = GUICtrlCreateButton("Cancel", 625, 210, 60, 30, $SS_CENTER)
GUICtrlSetState($iOKButton,512)
GUISetState(@SW_SHOW, $hGUI)

Local $iMsg = 0
While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $iOKButton
            ; MsgBox($MB_SYSTEMMODAL, "GUI Event", "You selected the OK button.")
            ExitLoop
        Case $iCancelButton
            Exit
        Case $GUI_EVENT_CLOSE
            ;MsgBox($MB_SYSTEMMODAL, "GUI Event", "You selected the Close button. Exiting...")
            Exit
    EndSwitch
WEnd

GUIDelete($hGUI)

 

Edited by emendelson
Minor fix
Posted
53 minutes ago, emendelson said:

What obvious error am I making here?

The simplest one - everyone did it once  :D
... maybe some calculation about label sizes ?  :idiot:

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...