Jump to content
Burgaud

need help with resizing labels and list

Recommended Posts

Burgaud

I have a GUI (called $MW) that can resize.
 

Global $GUIMinX = 0.75 * @DesktopWidth
Global $GUIMinY = 0.75 * @DesktopHeigth 

func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam)
    $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tagMaxinfo, 7, $GUIMinX) ; min X
    DllStructSetData($tagMaxinfo, 8, $GUIMinY) ; min Y
    DllStructSetData($tagMaxinfo, 9, @DesktopWidth ); max X
    DllStructSetData($tagMaxinfo, 10, @DesktopHeigth ) ; max Y
    return 0
endfunc ;==>WM_GETMINMAXINFO

GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

Global $MW = GUICreate($TITLE & " " & $VERSION, $GUIMinX, $GUIMinY, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

 

Within this GUI, I have several panels/items: Labels, List, Buttons, Inputs in different locations, sizes, fonts, colors and bgcolors.
 

local $Panel1 = GUICtrlCreateLabel("Names", 5, 5, 200, 150)
local $Panel2 = GUICtrlCreateList("", 210, 5, $GUIMinX-215, 150)
local $Panel3 = GUICtrlCreateLabel("Address", 5, 160, 200, 150)
local $Panel4 = GUICtrlCreateList("", 210, 160, $GUIMinX-215, 150)
local $Panel5 = GUICtrlCreateList("", 5, 310, $GUIMinX-10, $GUIMinY-350)


Here is my problem:

I dont want Panel1 and Panel3 to resize. both fixed dimension. (Both are Labels)

Panel2, and Panel4 is allowed to resize horizontally only. (Both are Lists)

Panel5 is allowed to resize horizontally and vertically (no problem).

How to do?

 

PS: What is the equivalent in Autoit of:

perl's ROText

perl's -relief => 'groove' (for the outlines of labels and lists).

 

thanks!

 

 

 

 

 

Share this post


Link to post
Share on other sites
Xandy

I keep my GUI control sizes the same with this function: GUICtrlSetResizing()

Not sure if that's what you're looking for :).

; Confirm Button (Stays at bottom right during window resize event and retains starting size)
$aControl[$eCommand_dialog_confirm][$eControl_data] = control_create("Button", "Confirm", $aGui_rect[2] - 75, $aGui_rect[3] - $control_pos_pad_from_bottom, 50, 20, "Confirm Commands and Exit")

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM)

control_create() is a custom function to provide labels and tooltips for controls.  You can replace that line with any GUIControlCreate.. function.

Edited by Xandy

Share this post


Link to post
Share on other sites
Melba23

Burgaud,

This should get you started:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $GUIMinX = 0.5 * @DesktopWidth
Global $GUIMinY = 0.5 * @DesktopHeight

Global $MW = GUICreate("Test", $GUIMinX, $GUIMinY, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

local $Panel1 = GUICtrlCreateLabel("Names", 5, 5, 200, 150)
GUICtrlSetBkColor($Panel1, 0xFFCCCC)
GUICtrlSetResizing($Panel1, BitOR($GUI_DOCKSIZE, $GUI_DOCKALL))
local $Panel2 = GUICtrlCreateList("", 210, 5, $GUIMinX-215, 150)
GUICtrlSetResizing($Panel2, BitOR($GUI_DOCKAUTO, $GUI_DOCKHEIGHT, $GUI_DOCKTOP))
local $Panel3 = GUICtrlCreateLabel("Address", 5, 160, 200, 150)
GUICtrlSetBkColor($Panel3, 0xCCFFCC)
GUICtrlSetResizing($Panel3, BitOR($GUI_DOCKSIZE, $GUI_DOCKALL))
local $Panel4 = GUICtrlCreateList("", 210, 160, $GUIMinX-215, 150)
GUICtrlSetResizing($Panel4, BitOR($GUI_DOCKAUTO, $GUI_DOCKHEIGHT, $GUI_DOCKTOP))
local $Panel5 = GUICtrlCreateList("", 5, 310, $GUIMinX-10, $GUIMinY-350)
GUICtrlSetResizing($Panel5, $GUI_DOCKTOP)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

M23

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Burgaud

So this GUICtrlSetResizing function is more or less similar to perl's pack with some differences:

GUICtrlSetResizing expands ratiometric to the original size it was created.

pack expands to cover everything. I just need to think differently away from perl's method

indeed it is the start I am looking for.
 

thanx

Edited by Burgaud

Share this post


Link to post
Share on other sites
Burgaud

after some more thoughts, I found $GUI_EVENT_RESIZED as the perfect solution to reshaping/resizing GUI!

I just need to GUICtrlSetPos each panel after a resize event which is not a huge task.

awesome! autoit thought of it!

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

×