Jump to content

Recommended Posts

Posted (edited)

hi all. is it possible to re-size a form while its open through the click of a button?

i have no code for this cause i could get no info on how to do it.

here is what i want to do:

1. this is the normal form

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form1", 155, 122, 653, 431)
$Button1 = GUICtrlCreateButton("Redesign", 40, 88, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 16, 8, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 16, 32, 121, 21)
$Combo1 = GUICtrlCreateCombo("Combo1", 16, 64, 121, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

2. when i press the button i want to do this:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form1", 155, 202, 653, 431)
$Button1 = GUICtrlCreateButton("Redesign", 40, 168, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 16, 8, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 16, 32, 121, 21)
$Combo1 = GUICtrlCreateCombo("Combo1", 16, 144, 121, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Edit1 = GUICtrlCreateEdit("", 16, 64, 121, 73)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

any help will be appreciated..

Edited by Tiboi
Posted

Doesn't work as well as I wish, but it should stand as a basic starting point for you.

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

$large = False

$Form2 = GUICreate("Form1", 155, 122, 653, 431)

$Button1 = GUICtrlCreateButton("Redesign", 40, 88, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 16, 8, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 16, 32, 121, 21)
$Combo1 = GUICtrlCreateCombo("Combo1", 16, 64, 121, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Edit1 = GUICtrlCreateEdit("", 16, 64, 121, 73)
GUICtrlSetData(-1, "Edit1")
GUICtrlSetState (-1, $GUI_HIDE + $GUI_DISABLE)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _Redesign()
    EndSwitch
WEnd

Func _Redesign()
    If $large = False Then
        WinMove ($Form2, "", Default, Default, 155, 202)
        GUICtrlSetPos ($Button1, 40, 168)
        GUICtrlSetPos ($Combo1, 16, 144)
        GUICtrlSetState ($Edit1, $GUI_SHOW + $GUI_ENABLE)
        $large = True
    Else
        WinMove ($Form2, "", Default, Default, 155, 122)
        GUICtrlSetPos ($Button1, 40, 88)
        GUICtrlSetPos ($Combo1, 16, 64)
        GUICtrlSetState ($Edit1, $GUI_HIDE + $GUI_DISABLE)
        $large = False
    EndIf
EndFunc

Cheers,

Brett

Posted

You may resize any GUI with WinMove. For docking GUI elements in some place, keeping same size you could use GUICtrlSetResizing.

Posted

You may resize any GUI with WinMove. For docking GUI elements in some place, keeping same size you could use GUICtrlSetResizing.

ok thanks

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
×
×
  • Create New...