Jump to content
Sign in to follow this  

resizing trouble

Recommended Posts


I have a gui and the only thing i cant get to resize is this:

$iptext = _GUICtrlEdit_Create($Form1_1, $ipconfig, 350, 16, 385, 550, BitOR($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetState($iptext, $GUI_FOCUS)


this isnt what the code looked like originally but i tried messing with it and couldnt get it working. let me know if you need the whole script. any ideas?

Share this post

Link to post
Share on other sites


You need to register the WM_MOVE message and then resize your control within the function. Something like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#Include <GuiEdit.au3>

Global $hGUI = GUICreate("Test", 500, 500, -1, -1, $WS_SIZEBOX)

GUICtrlSetState($iptext, $GUI_FOCUS)

GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")


While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE


Func MY_WM_SIZE($hWnd, $Msg, $wParam, $lParam)

    Local $iGUIWidth = BitAND($lParam, 0xFFFF)
    Local $iGUIHeight = BitShift($lParam, 16)

    ControlMove($hGUI, "", $iptext, Default, Default, $iGUIWidth - 20, $iGUIHeight - 20)



I believe the problem arises because the _GUICtrlEdit_Create function returns a handle and not a ControlID, so GUICtrlSetResizing will not work.


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

Yes, the external controls don't respond to the resizing modes. But often you can use the internal controls, get the handle with GuiCtrlGetHandle then you can use that handle for the external functions.

For example, I have done this in one script where I wanted resizing to work.

Global $Edit1 = GUICtrlCreateEdit("edit 1", 4, 14, $LastWid - 4, $LastHt - 18, $edStyles)
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
_GUICtrlEdit_SetMargins(GUICtrlGetHandle($Edit1), $EC_LEFTMARGIN, 2)

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

oh ok. that makes sense. i always wondered why there were seeming duplicate functions but now i see one works with the handle and the other the controlID. i just switched to a GUICtrlCreateEdit. its working now. thanks for the help.

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