Sign in to follow this  
Followers 0
fett8802

[SOLVED ] Window Maximizing

4 posts in this topic

#1 ·  Posted (edited)

This isn't so much asking about specific code as much as ideas for a good way to go about doing this.

I have a fairly complex GUI that is essentially an IDE for a coding language that my company uses internally. The GUI itself is fully functional and now on version 8.6.7. I'm adding a save tree functionality to it in order to simplify the saving and loading process. This is also fully functional.

Now, where I run into my question is this: The save tree can be toggled on or off and when off, only the IDE window is viewed. This window can be maximized just like normal. When the save tree is toggled on, it docks to the left side of the GUI and resizes and minimizes with the IDE. The tree itself is only about an inch (comparably) in width, which is fixed, and only resizes to become taller or shorter.

My question is: what is a good way to go about making it so that when the save tree is toggled ON and the IDE is maximized, that the IDE and the save tree maximize together, but the IDE leaves room on the left for the save tree to be visible.

If that isn't very clear, I can upload pics of what I mean.

Thanks!!!

Edited by fett8802

[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

Share this post


Link to post
Share on other sites



fett8802,

You could use something like this to limit the size of your GUI so that there is always room for the tree. As you can see, you use WinMove to get the maximized GUI away from the left edge of the screen. :graduated:

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

Global $GUIMINWID = 300, $GUIMINHT = 100 ; set your restrictions here
Global $GUIMAXWID = 800, $GUIMAXHT = 500

$hGUI = GUICreate("Test", 500, 500, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

GUISetState()

GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_MAXIMIZE
            WinMove($hGUI, "", 100, 0)
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam)
    $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tagMaxinfo, 7, $GUIMINWID)  ; min X
    DllStructSetData($tagMaxinfo, 8, $GUIMINHT)   ; min Y
    DllStructSetData($tagMaxinfo, 9, $GUIMAXWID ) ; max X
    DllStructSetData($tagMaxinfo, 10, $GUIMAXHT ) ; max Y
    Return 0
EndFunc   ;==>WM_GETMINMAXINFO

I would look at the @DesktopWidth and @DesktopHeight macros to set the required max sizes. :D

Please ask if anything is unclear - or if it does not do what you want. :(

M23


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

#3 ·  Posted (edited)

Thanks Melba! That will do exactly what I need, but I have one problem.

I'm using Opt("GUIOnEventMode",1) and as such, can't use GUIGetMsg. Is there anyway to accomplish that same polling of the GUI for the maximize command without using GUIGetMsg?

Thanks!

EDIT: Figured it out:

GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Maximize_Window",$MainGUI)

Thanks again Melba!

Edited by fett8802

[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

fett8802,

Is there anyway to accomplish that same polling of the GUI for the maximize command without using GUIGetMsg

Of course: :graduated:

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

Opt("GUIOnEventMode", 1)

Global $GUIMINWID = 300, $GUIMINHT = 100 ; set your restrictions here
Global $GUIMAXWID = 800, $GUIMAXHT = 500

$hGUI = GUICreate("Test", 500, 500, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetOnEvent($GUI_EVENT_CLOSE, "_On_Exit")
GUISetOnEvent($GUI_EVENT_Maximize, "_On_Max")

GUISetState()

GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

While 1
    Sleep(100)
WEnd

Func _On_Exit()
    Exit
EndFunc

Func _On_Max()
    WinMove($hGUI, "", 100, 0)
EndFunc

Func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam)
    $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tagMaxinfo, 7, $GUIMINWID)  ; min X
    DllStructSetData($tagMaxinfo, 8, $GUIMINHT)   ; min Y
    DllStructSetData($tagMaxinfo, 9, $GUIMAXWID ) ; max X
    DllStructSetData($tagMaxinfo, 10, $GUIMAXHT ) ; max Y
    Return 0
EndFunc   ;==>WM_GETMINMAXINFO

M23

Edit: See you found it yourself - always more satisfying that way! :(

Edited by Melba23

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

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  
Followers 0