Jump to content

Recommended Posts

Posted

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)

GUICtrlSetResizing($iptext,$GUI_DOCKAUTO+$GUI_DOCKRIGHT)
GUISetState(@SW_SHOW

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?

  • Moderators
Posted

bobbintb,

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)

Global $iptext = _GUICtrlEdit_Create($hGUI, "Fred", 10, 10, 480, 480, BitOR($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetState($iptext, $GUI_FOCUS)

GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

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)

    Return $GUI_RUNDEFMSG

EndFunc;==>MY_WM_SIZE

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

M23

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:

Spoiler

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

 

Posted

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.
Posted

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.

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...