Sign in to follow this  
Followers 0
T0M50N

Input's clickable area doesn't properly scale with it's appearance

3 posts in this topic

#1 ·  Posted (edited)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$MainForm = GUICreate('Form1', @DesktopWidth/2, @DesktopHeight/2, @DesktopWidth/4, @DesktopHeight/4, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME))
$MenuItem1 = GUICtrlCreateMenu("File")
    $MenuItem1Pref = GUICtrlCreateMenuItem("Preferences", $MenuItem1)
    $MenuItem12 = GUICtrlCreateMenuItem("About", $MenuItem1)
    $MenuItem13 = GUICtrlCreateMenuItem("Help", $MenuItem1)
GUISetState(@SW_SHOW, $MainForm)

$Preferences = GUICreate("Preferences", 540, 118, (@DesktopWidth/2)-(@DesktopWidth/4)/2, (@DesktopHeight/2)-118/2, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME))
$Label1 = GUICtrlCreateLabel("Record Key:", 88, 8, 90, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Button1 = GUICtrlCreateButton("RCtrl + RShift + RAlt + Printscreen", 184, 8, 201, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label2 = GUICtrlCreateLabel("Source Video Location: ", 8, 40, 173, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Input1 = GUICtrlCreateInput("Input1", 184, 40, 249, 21)
GUICtrlSetResizing(-1,$GUI_DOCKBORDERS)
$Button2 = GUICtrlCreateButton("Browse", 440, 40, 89, 25)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label3 = GUICtrlCreateLabel("Video Output Format: ", 24, 72, 161, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Label4 = GUICtrlCreateLabel("Custom Name", 193, 72, 70, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Label5 = GUICtrlCreateLabel("Date", 272, 72, 27, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Label6 = GUICtrlCreateLabel("Unique Code", 312, 72, 66, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Label7 = GUICtrlCreateLabel("Video Number", 392, 72, 71, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Label8 = GUICtrlCreateLabel("Trim Times", 472, 72, 55, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Checkbox1 = GUICtrlCreateCheckbox("", 215, 89, 17, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Checkbox2 = GUICtrlCreateCheckbox("", 273, 91, 17, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Checkbox3 = GUICtrlCreateCheckbox("", 336, 91, 17, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Checkbox4 = GUICtrlCreateCheckbox("", 416, 90, 17, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
$Checkbox5 = GUICtrlCreateCheckbox("", 489, 89, 17, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)
GUIRegisterMsg($WM_GETMINMAXINFO, "PreferencesWinSizeLimit")

Func PreferencesWinSizeLimit($hWnd, $Msg, $wParam, $lParam)
    $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int",$lParam)
    If $hWnd = $Preferences Then
        DllStructSetData($minmaxinfo,7,550) ; min X
        DllStructSetData($minmaxinfo,8,156) ; min Y
        DllStructSetData($minmaxinfo,10,156) ; max Y
    EndIf
    Return 0
EndFunc

While 1
    $nMsg = GUIGetMsg(1)
    Switch $nMsg[1]

        Case $MainForm

            Switch $nMsg[0]

                Case $GUI_EVENT_CLOSE
                    Exit

                Case $MenuItem1Pref
                    GUISetState(@SW_SHOW, $Preferences)

            EndSwitch


        Case $Preferences

            Switch $nMsg[0]

                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $Preferences)

            EndSwitch
    EndSwitch
WEnd
$Input1 = GUICtrlCreateInput("Input1", 184, 40, 249, 21)
GUICtrlSetResizing(-1,$GUI_DOCKBORDERS)

The actual clickable area of the input scales incorrectly.

FwJ259H.png

The red box shows where you can click to give focus to the input.

Help would be much appreciated but I'm off to bed now so don't expect a speedy reply.

Edited by T0M50N

Share this post


Link to post
Share on other sites



Change it to this:

$Label2 = GUICtrlCreateLabel("Source Video Location: ", 8, 40, 173, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH)

Your label is overwriting the left side of the input, this keeps the size of the label to the original size.

1 person likes this

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Great, thanks. :D

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  
Followers 0