Jump to content

Preserve controls aspect during gui resize


lucamad
 Share

Recommended Posts

Hi ;)

This is a simple GUI with a group and a listview controls. During a GUI resize, the controls position change, so the original window aspect becomes bad. Look at the attached image: the black boxes are what I don't want to see.

Normal:

Posted Image

Resized:

Posted Image

How to avoid this behavior? It seems that the "group" control is resized different from the other controls, as the listview in example. The resize of "group" control is the best for me, because it is pulled up to the maximum size, without empty space in the window.

I tried all the possible resize arrangements with koda designer, but with no success.

I also tried to work with WM_SIZING function but I don't know which code to write...

In the forum there are many open 3d but in the examples I've found, this problem is present. What do u think about?

THX

Form1.au3

Link to comment
Share on other sites

  • Moderators

lucamad,

Just add

Opt("GUIResizeMode", 102)

at the top of your script. ;)

You can use the Help file to work out why 102 is the number to use! :)

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

 

Link to comment
Share on other sites

lucamad,

Just add

Opt("GUIResizeMode", 102)

at the top of your script. ;)

You can use the Help file to work out why 102 is the number to use! ;)

M23

Good! Works fine...

So the number 102 is: dock left, dock right, dock top and dock bottom. Very usefull for simple GUI.

I'm making another example now, more complicated, to learn the controls resize ways.

Draw near to real-world examples! Would you help me? :)

In this new example, I'm not able to control some controls resizing options. In particular:

- the $buttonselectFolder should remain close to textbox ($txtFolder) during resize

- the $input2 textbox moves away from $labelTest during resize

- the treeview and listview move away from each other during resize, generating empty space.

Is there a solution?

Thanks Melba!

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=form1.kxf
$Form1 = GUICreate("Form1", 618, 394, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))
$groupSelectFolder = GUICtrlCreateGroup("Folder", 8, 8, 601, 57)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT)
$labelSelectFolder = GUICtrlCreateLabel("Folder name:", 40, 32, 65, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT)
$txtFolder = GUICtrlCreateInput("", 112, 28, 313, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT)
$buttonselectFolder = GUICtrlCreateButton("...", 432, 32, 35, 17)
GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$buttonOk = GUICtrlCreateButton("OK", 520, 24, 75, 25)
GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$groupFiles = GUICtrlCreateGroup("Files", 8, 72, 601, 313)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$TreeView1 = GUICtrlCreateTreeView(24, 120, 185, 257, BitOR($GUI_SS_DEFAULT_TREEVIEW,$WS_BORDER))
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$TreeView1_0 = GUICtrlCreateTreeViewItem("Example Tree", $TreeView1)
$ListView1 = GUICtrlCreateListView("Col1|Col2", 216, 120, 386, 257)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$ListView1_0 = GUICtrlCreateListViewItem("Item1", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("Item2", $ListView1)
$Input1 = GUICtrlCreateInput("Input1", 48, 96, 121, 21)
GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKHEIGHT)
$Input2 = GUICtrlCreateInput("Input2", 328, 96, 185, 21)
GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKHEIGHT)
$labelTest = GUICtrlCreateLabel("Test Label:", 264, 100, 57, 17)
GUICtrlSetResizing(-1, $GUI_DOCKTOP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEnd

Form1.zip

Link to comment
Share on other sites

  • Moderators

lucamad,

Is there a solution?

Quite possibly - but I use resizing code very little in my own scripts so I cannot offer much more help. :)

If you put Opt("GUIResizeMode", $GUI_DOCKAUTO) at the top of your script and remove all the GUICtrlSetResizing lines, the reult is not too bad - you get the relative positions maintained, but the sizes alter. Is that any better? ;)

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...