Sign in to follow this  
Followers 0
HaxLi

Resize GUI with Input change

10 posts in this topic

#include <GuiConstants.au3>

Dim $b
$a = 1

;   :::GUI:::::::::
$c = GUICreate("2U 10.07", 160, 200+$a*20, "", "", $WS_SIZEBOX) ; I want to make resizable window by increase/decrease GUIinput

GUICtrlCreateGroup("Info", 5, 5, 150, 75)       ; This is not fixed when I resizse manualy
$d = GUICtrlCreateInput($a, 15, 20, 30, 20)     ; |_ this is not fixed too, I want tobe them fixed
$b = GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, 9, 1)

GUISetFont(8, "", 5)
GUICtrlCreateLabel("[ 2006 © HaxLi ]", 70, 0, 77)
GUICtrlSetColor(-1,0xCCCCCC)

GUISetState()

;   :::Loop::::::::
Wait()

Func Wait()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg == $GUI_EVENT_CLOSE
        Exit
    Case $msg == $b                 ; Not sure if I do it in right way..
        $a = GUICtrlRead($d)
        GUICtrlSetData($c, $a, $a)
    EndSelect
    Sleep(20)
WEnd
EndFunc

I'm not sure how to make this Increase/Decrease size of my GUI by clickin on Input values..

If anyone know how to do this, would be nice to hear from you :}

Thank You.

Friendly,

HaxLi

Share this post


Link to post
Share on other sites



#include <GuiConstants.au3>

Dim $b
$a = 1

;   :::GUI:::::::::
$c = GUICreate("2U 10.07", 160, 200+$a*20, "", "", $WS_SIZEBOX) ; I want to make resizable window by increase/decrease GUIinput

GUICtrlCreateGroup("Info", 5, 5, 150, 75)       ; This is not fixed when I resizse manualy
$d = GUICtrlCreateInput($a, 15, 20, 30, 20)     ; |_ this is not fixed too, I want tobe them fixed
$b = GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, 9, 1)

GUISetFont(8, "", 5)
GUICtrlCreateLabel("[ 2006 © HaxLi ]", 70, 0, 77)
GUICtrlSetColor(-1,0xCCCCCC)

GUISetState()

;   :::Loop::::::::
Wait()

Func Wait()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg == $GUI_EVENT_CLOSE
        Exit
    Case $msg == $b                 ; Not sure if I do it in right way..
        $a = GUICtrlRead($d)
        GUICtrlSetData($c, $a, $a)
    EndSelect
    Sleep(20)
WEnd
EndFunc

I'm not sure how to make this Increase/Decrease size of my GUI by clickin on Input values..

If anyone know how to do this, would be nice to hear from you :}

Thank You.

Friendly,

HaxLi

maybe like this :

#include <GuiConstants.au3>

Global Const $step_res = 20

Global Const $GUI_title = "2U 10.07"

Global Const $GUI_width = 160,$GUI_high = 200+$step_res

Dim $b

Dim $a = 1

; :::GUI:::::::::

$c = GUICreate($GUI_title, $GUI_width, $GUI_high, "", "", $WS_SIZEBOX)

GUICtrlCreateGroup("Info", 5, 5, 150, 75)

$d = GUICtrlCreateInput($a, 15, 20, 30, 20)

$b = GUICtrlCreateUpdown(-1)

GUICtrlSetLimit(-1, 9, 1)

GUISetFont(8, "", 5)

GUICtrlCreateLabel("[ 2006 © HaxLi ]", 70, 0, 77)

GUICtrlSetColor(-1,0xCCCCCC)

GUISetState()

; :::Loop::::::::

Wait()

Func Wait()

While 1

$msg = GuiGetMsg()

Select

Case $msg == $GUI_EVENT_CLOSE

Exit

Case $msg == $b ; Not sure if I do it in right way..

resizeWin()

EndSelect

Sleep(20)

WEnd

EndFunc

Func resizeWin()

Local $size = WinGetPos($GUI_title)

$a = GUICtrlRead($d)

WinMove ($GUI_title, "", $size[0], $size[1], $a*$GUI_width, $a*$GUI_high)

EndFunc


[font="Courier New"][center]PACOxxl[/center][/font]

Share this post


Link to post
Share on other sites

maybe like this :

#include <GuiConstants.au3>

Global Const $step_res = 20

Global Const $GUI_title = "2U 10.07"

Global Const $GUI_width = 160,$GUI_high = 200+$step_res

Dim $b

Dim $a = 1

; :::GUI:::::::::

$c = GUICreate($GUI_title, $GUI_width, $GUI_high, "", "", $WS_SIZEBOX)

GUICtrlCreateGroup("Info", 5, 5, 150, 75)

$d = GUICtrlCreateInput($a, 15, 20, 30, 20)

$b = GUICtrlCreateUpdown(-1)

GUICtrlSetLimit(-1, 9, 1)

GUISetFont(8, "", 5)

GUICtrlCreateLabel("[ 2006 © HaxLi ]", 70, 0, 77)

GUICtrlSetColor(-1,0xCCCCCC)

GUISetState()

; :::Loop::::::::

Wait()

Func Wait()

While 1

$msg = GuiGetMsg()

Select

Case $msg == $GUI_EVENT_CLOSE

Exit

Case $msg == $b ; Not sure if I do it in right way..

resizeWin()

EndSelect

Sleep(20)

WEnd

EndFunc

Func resizeWin()

Local $size = WinGetPos($GUI_title)

$a = GUICtrlRead($d)

WinMove ($GUI_title, "", $size[0], $size[1], $a*$GUI_width, $a*$GUI_high)

EndFunc

sorry, this is better :

#include <GuiConstants.au3>

Global Const $step_res = 20

Global Const $GUI_title = "2U 10.07"

Global Const $GUI_width = 160,$GUI_high = 200+$step_res

Global Const $UPlimit = 9, $DOWNlimit = 1

Dim $b

Dim $a = 1

; :::GUI:::::::::

$c = GUICreate($GUI_title, $GUI_width, $GUI_high, "", "", $WS_SIZEBOX)

GUICtrlCreateGroup("Info", 5, 5, 150, 75)

$d = GUICtrlCreateInput($a, 15, 20, 30, 20)

$b = GUICtrlCreateUpdown(-1)

GUICtrlSetLimit(-1, $UPlimit, $DOWNlimit)

GUISetFont(8, "", 5)

GUICtrlCreateLabel("[ 2006 © HaxLi ]", 70, 0, 77)

GUICtrlSetColor(-1,0xCCCCCC)

GUISetState()

; :::Loop::::::::

Wait()

Func Wait()

While 1

$msg = GuiGetMsg()

Select

Case $msg == $GUI_EVENT_CLOSE

Exit

Case $msg == $b

resizeWin()

Case $msg == $d

resizeWin()

EndSelect

Sleep(20)

WEnd

EndFunc

Func resizeWin()

Local $size = WinGetPos($GUI_title)

Local $a_tmp = GUICtrlRead($d)

If ($a_tmp >= $DOWNlimit) And ($a_tmp <= $UPlimit) Then

Local $diff = $a_tmp - $a

If $diff <> 0 Then

WinMove ($GUI_title, "", $size[0], $size[1], $GUI_width + ($a+$diff)*$step_res, $GUI_high + ($a+$diff)*$step_res)

$a = $a_tmp

EndIf

Else

MsgBox(0,"ERROR","Input out of range <" & $DOWNlimit & "," & $UPlimit & ">")

GUICtrlSetData($d, $a)

EndIf

EndFunc


[font="Courier New"][center]PACOxxl[/center][/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

#include <GuiConstants.au3>

Global Const $step_res = 20
Global Const $GUI_title = "2U 10.07"
Global Const $GUI_width = 160,$GUI_high = 200+$step_res
Global Const $UPlimit = 9, $DOWNlimit = 1
Dim $b
Dim $a = 1

; :::GUI:::::::::
$c = GUICreate($GUI_title, $GUI_width, $GUI_high, "", "", $WS_SIZEBOX)

GUICtrlCreateGroup("Info", 5, 5, 150, 75)
$d = GUICtrlCreateInput($a, 15, 20, 30, 20)
$b = GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, $UPlimit, $DOWNlimit)

GUISetFont(8, "", 5)
GUICtrlCreateLabel("[ 2006 © HaxLi ]", 70, 0, 77)
GUICtrlSetColor(-1,0xCCCCCC)

GUISetState()

; :::Loop::::::::
Wait()

Func Wait()
While 1
$msg = GuiGetMsg()
Select
Case $msg == $GUI_EVENT_CLOSE
    Exit
Case $msg == $b
    resizeWin()
Case $msg == $d
    resizeWin()
EndSelect
Sleep(20)
WEnd
EndFunc

Func resizeWin()
Local $size = WinGetPos($GUI_title)
Local $a_tmp = GUICtrlRead($d)
If ($a_tmp >= $DOWNlimit) And ($a_tmp <= $UPlimit) Then
    Local $diff = $a_tmp - $a
    If $diff <> 0 Then
        WinMove ($GUI_title, "", $size[0], $size[1], $size[2], $GUI_high + ($a+$diff)*$step_res)
        $a = $a_tmp
    EndIf
Else
    MsgBox(0,"ERROR","Input out of range <" & $DOWNlimit & "," & $UPlimit & ">")
    GUICtrlSetData($d, $a)
EndIf
EndFunc

Changed this:

WinMove ($GUI_title, "", $size[0], $size[1], $size[2], $GUI_high + ($a+$diff)*$step_res)

Thank you for WinMove and WinGetPos commands :]

But the another problem still exist.. when I resize it, GUIGroup do deformation and Input moves out of place.. so I need them to be fixed in their position :]

Thank you :}

Edited by HaxLi

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>

Global Const $step_res = 20
Global Const $GUI_title = "2U 10.07"
Global Const $GUI_width = 160,$GUI_high = 200+$step_res
Global Const $UPlimit = 9, $DOWNlimit = 1
Dim $b
Dim $a = 1

; :::GUI:::::::::
$c = GUICreate($GUI_title, $GUI_width, $GUI_high, "", "", $WS_SIZEBOX)

GUICtrlCreateGroup("Info", 5, 5, 150, 75)
GUICtrlSetResizing (-1,$GUI_DOCKALL)

$d = GUICtrlCreateInput($a, 15, 20, 30, 20)
GUICtrlSetResizing (-1,$GUI_DOCKALL)

$b = GUICtrlCreateUpdown(-1)
GUICtrlSetResizing (-1,$GUI_DOCKALL)

GUICtrlSetLimit(-1, $UPlimit, $DOWNlimit)

GUISetFont(8, "", 5)
GUICtrlCreateLabel("[ 2006 © HaxLi ]", 70, 0, 77)
GUICtrlSetResizing (-1,$GUI_DOCKALL)

GUICtrlSetColor(-1,0xCCCCCC)

GUISetState()

; :::Loop::::::::
Wait()

Func Wait()
While 1
$msg = GuiGetMsg()
Select
Case $msg == $GUI_EVENT_CLOSE
    Exit
Case $msg == $b
    resizeWin()
Case $msg == $d
    resizeWin()
EndSelect
Sleep(20)
WEnd
EndFunc

Func resizeWin()
Local $size = WinGetPos($GUI_title)
Local $a_tmp = GUICtrlRead($d)
If ($a_tmp >= $DOWNlimit) And ($a_tmp <= $UPlimit) Then
    Local $diff = $a_tmp - $a
    If $diff <> 0 Then
        WinMove ($GUI_title, "", $size[0], $size[1], $size[2], $GUI_high + ($a+$diff)*$step_res)
        $a = $a_tmp
    EndIf
Else
    MsgBox(0,"ERROR","Input out of range <" & $DOWNlimit & "," & $UPlimit & ">")
    GUICtrlSetData($d, $a)
EndIf
EndFunc



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Thank you for $GUI_DOCKALL command BigDod :}

Share this post


Link to post
Share on other sites

Thank you for $GUI_DOCKALL command BigDod :}

Your welcome.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

if you have

Opt("GUIResizeMode", $GUI_DOCKALL)

then you don't need to specify DOCKALL for every control.


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.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Thank you martin :]

Another problem is I can't find is that when I set 2 it goes ~+10 then back to 1 it goes -20. Then again 2 do +20 :]

And one more thing I want to do is to resize GUIgroup "Opts" with that window..

#include <GuiConstants.au3>
#include <Array.au3>

Opt("GUIResizeMode", 802) ;or $GUI_DOCKALL

Global Const $step_res = 20
Global Const $GUI_title = "2U 10.10"
Global Const $GUI_width = 160, $GUI_high = 140
Global Const $UPlimit = 35, $DOWNlimit = 1
Dim $sz = 1

;   :::HotKeyVars::
$kB = "F8"
$kA = "F9"
$kS = "F10"
$kL = "F9"

; :::GUI:::::::::
GUICreate($GUI_title, $GUI_width, $GUI_high)

GUICtrlCreateGroup("Info", 5, 5, 150, 75)
Opt("GUICoordMode", 0)
GUICtrlCreateLabel("" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Alt+", 10, 15, -1, 55)
GUICtrlCreateLabel($kB & @CRLF & _
$kA & @CRLF & _
$kS & @CRLF & _
$kL, 20, -1, -1, 55)
GUICtrlCreateLabel("Buy (on|off)" & @CRLF & _
"AFK" & @CRLF & _
"Stop" & @CRLF & _
"AutoLoot (on|off)", 30, -1, -1, 55)

Opt("GUICoordMode", 1)
GUISetFont(9)
GUICtrlCreateGroup("Opts", 5, 80, 150)
GUICtrlSetResizing (-1, 102) ;or $GUI_DOCKBORDERS
GUISetFont(6)

$szin = GUICtrlCreateInput($sz, 115, 75, 30, 14, $ES_RIGHT)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, $UPlimit, $DOWNlimit)

GUISetFont(8, "", 5)
GUICtrlCreateLabel("[ 2006 © HaxLi ]", 70, 0, 77)
GUICtrlSetColor(-1,0xCCCCCC)

GUISetState()

; :::Loop::::::::
;~ resizeWin()
Wait()

Func Wait()
While 1
$msg = GuiGetMsg()
Select
Case $msg == $GUI_EVENT_CLOSE
    Exit
Case $msg == $szin
    resizeWin()
EndSelect
Sleep(20)
WEnd
EndFunc

Func resizeWin()
Local $size = WinGetPos($GUI_title) ;It takes different values than I set at Global Const $GUI_width & $GUI_high
;~ _ArrayDisplay($size, "$size")
Local $sz_tmp = GUICtrlRead($szin)
If ($sz >= $DOWNlimit) And ($sz <= $UPlimit) Then
    Local $diff = $sz_tmp - $sz
    If $diff <> 0 Then
        WinMove ($GUI_title, "", $size[0], $size[1], $size[2], ($diff + $sz) * $step_res + $GUI_high)
        $sz = $sz_tmp
    EndIf
Else
    MsgBox(16,"ERROR","Input out of range < " & $DOWNlimit & " | " & $UPlimit & " >")
    GUICtrlSetData($szin, $sz)
EndIf
EndFunc

Thank you, if any help ^^

EDIT: Found the solution for resize GUIgroup "Opts" with GUICtrlSetResizing (-1,102) or $GUI_DOCKBORDERS

And found that WinGetPos takes different values than I set at Global Const $GUI_width & $GUI_high and different thant WinGetClientSize gets

And WinMove uses WinGetPos. Waht commandcould thange this?

Edited by HaxLi

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

And found that WinGetPos takes different values than I set at Global Const $GUI_width & $GUI_high and different thant WinGetClientSize gets

And WinMove uses WinGetPos. Waht commandcould thange this?

GUICREATE("title",wid,ht) creates a window with a client size of wid x ht.

If you try WINGETCLIENTSIZE you will see that the dimensions you specified are retained.

The left, right and bottom border widths are (WindowWidth - ClientWidth)/2,

so the title bar height is WindowHeight - ClientHeight - BorderWidth.

Edited by martin

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.

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