GNGNUT

Auto Size A Tab in a Gui

3 posts in this topic

hi guys 

I'm sorry if this has been asked before,

I'm trying to get my head around the auto resize of Gui's 

Including Tabs in the gui, 

I have read the Help file but i am still struggling to understand to resize all of this at the same time, 

i have generated gui(s) in the past but always kept them a static size - but this one its not practical to keep as 750 x 480, 

as I'm looking to expand my knowledge and build a dynamic gui which can grow in size on its own, 

can anyone simplify - to and idiot like me of how the process works, 

does it need an action/event  in order  to auto resize, ? is a main question  

below is sample script I'm trying to get to resize, ( tab, button(s) and labels ) I have been reading forum post about adding resize and using

GUICtrlSetResizing - but not sure if I'm using this correctly, if i am - even when i max the window every thing stays the same size, and shifts to top corner, 

again sorry - I'm stupid and simple minded  and sometimes need it explained differently,

kind regards 

Craig 

 

HotKeySet("{ESC}","terminate")
func Terminate()
    Exit
EndFunc

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <FontConstants.au3>
#include <ColorConstants.au3>
#include <Date.au3>
#include <GuiListView.au3>

#Region ### START Koda GUI section ### Form=
local $TBL1Form1 = GUICreate("FORM TITLE", 750, 458, -1,-1,0x00010000) ;Style enables the Max button
$Tab1 = GUICtrlCreateTab(0, 8, 750, 425)
$TabSheet1 = GUICtrlCreateTabItem("Tab one")
$Label1 = GUICtrlCreateLabel("LABLE ONE", 178, 48, 406, 49)
GUICtrlSetFont(-1, 30, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Label2 = GUICtrlCreateLabel("LABLE TWO", 128, 136, 93, 36)
GUICtrlSetFont(-1, 20, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Label3 = GUICtrlCreateLabel("LABLE THREE", 388, 131, 82, 36)
GUICtrlSetFont(-1, 20, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Button1 = GUICtrlCreateButton("1", 8, 192, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Button2 = GUICtrlCreateButton("2", 8, 225, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Button3 = GUICtrlCreateButton("3", 8, 259, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)
GUISetState(@SW_SHOW)
#Region ### END Koda GUI section ### Form=
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites



With GuiCtrlSetResizing:

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

#Region ### START Koda GUI section ### Form=
local $TBL1Form1 = GUICreate("FORM TITLE", 750, 458, -1,-1,BitOR($WS_SYSMENU,$WS_SIZEBOX,$WS_MAXIMIZEBOX,$WS_MINIMIZEBOX))
$Tab1 = GUICtrlCreateTab(0, 8, 750, 425)
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
$TabSheet1 = GUICtrlCreateTabItem("Tab one")
$Label1 = GUICtrlCreateLabel("LABLE ONE", 178, 48, 406, 49)
GUICtrlSetFont(-1, 30, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Label2 = GUICtrlCreateLabel("LABLE TWO", 128, 136, 93, 36)
GUICtrlSetFont(-1, 20, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Label3 = GUICtrlCreateLabel("LABLE THREE", 388, 131, 82, 36)
GUICtrlSetFont(-1, 20, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Button1 = GUICtrlCreateButton("1", 8, 192, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Button2 = GUICtrlCreateButton("2", 8, 225, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

$Button3 = GUICtrlCreateButton("3", 8, 259, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)
GUICtrlCreateTabItem("") ; end tabitem definition
GUISetState(@SW_SHOW)
#Region ### END Koda GUI section ### Form=
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites

Thank you - so clearly i was using this wrong :):) lol 

and i can now see the error of my ways 

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