Kip Posted September 7, 2008 Posted September 7, 2008 (edited) On request by Ptrex, I made this UDF.It splits GUIs into different pieces, which can be resized.Just like frames in HTML.Screenshot of a splitted GUI: (In case you have no idea what i'm talking about)If you still have no idea, just check it out.Example:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIFrame.au3> $FR_CALLBACK = "FrameSizing"; Gets called when a frame is being resized $GUI = GUICreate("Splitted GUI",600,500) $iFrame_Vert = _GUIFrame_Create($GUI, $FR_VERT) _GUIFrame_SetMin($iFrame_Vert, 200, 250); The left frame can't be smaller than 200px, and the right frame can't be smaller than 250px _GUIFrame_First($iFrame_Vert); Switch to first frame GUICtrlCreateLabel("Left frame of the vertical frame control",10,10,200,32) $hSecondFrame = _GUIFrame_GetInfo($iFrame_Vert, $FR_SECOND); Get the handle of the second frame $iFrame_Horz = _GUIFrame_Create($hSecondFrame, $FR_HORZ); Create another frame control in a frame _GUIFrame_SetMin($iFrame_Horz, 100, 100) _GUIFrame_First($iFrame_Horz) GUICtrlCreateLabel("Upper frame of the horizontal frame control",10,10,200,32) _GUIFrame_Second($iFrame_Horz) GUISetBkColor(0x65d956) $Button = GUICtrlCreateButton("A regular button",10,10,120,23) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button MsgBox(0,"Test","See, just a regular button") EndSwitch WEnd Func FrameSizing($iFrame, $iFirstSize, $iSecondSize) If $iFrame = $iFrame_Vert Then _GUIFrame_Move($iFrame_Horz, 0, 0, $iSecondSize) EndIf EndFuncMore functions are coming.Happy Framing GUIFrame.au3 Edited July 14, 2009 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
James Posted September 7, 2008 Posted September 7, 2008 I have wanted to know how to do this for ages! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
ptrex Posted September 7, 2008 Posted September 7, 2008 @Kip Nice but not quite perfect yet. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIFrame.au3> $FR_CALLBACK = "FrameSizing"; Gets called when a frame is being resized $GUI = GuiCreate("Splitted GUI" , 600, 500,(@DesktopWidth-600)/2, (@DesktopHeight-500)/2 , _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $iFrame_Vert = _GUIFrame_Create($GUI, $FR_VERT) _GUIFrame_SetMin($iFrame_Vert, 200, 250); The left frame can't be smaller than 200px, and the right frame can't be smaller than 250px _GUIFrame_First($iFrame_Vert); Switch to first frame GUICtrlCreateLabel("Left frame of the vertical frame control",10,10,200,32) $hSecondFrame = _GUIFrame_GetInfo($iFrame_Vert, $FR_SECOND); Get the handle of the second frame $iFrame_Horz = _GUIFrame_Create($hSecondFrame, $FR_HORZ); Create another frame control in a frame _GUIFrame_SetMin($iFrame_Horz, 100, 100) _GUIFrame_First($iFrame_Horz) GUICtrlCreateLabel("Upper frame of the horizontal frame control",10,10,200,32) _GUIFrame_Second($iFrame_Horz) GUISetBkColor(0x65d956) $Button = GUICtrlCreateButton("A regular button",10,10,120,23) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button MsgBox(0,"Test","See, just a regular button") EndSwitch WEnd Func FrameSizing($iFrame, $iFirstSize, $iSecondSize) If $iFrame = $iFrame_Vert Then _GUIFrame_Move($iFrame_Horz, 0, 0, $iSecondSize) EndIf EndFunc When resizing the Frame don't resize. Regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Kip Posted September 7, 2008 Author Posted September 7, 2008 Thats because, the frame control is a control. It isn't fullscreen, just a control that fills up the whole window.example:$GUI = GuiCreate("Splitted GUI" , 600, 500,(@DesktopWidth-600)/2, (@DesktopHeight-500)/2 , _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $iFrame_Vert = _GUIFrame_Create($GUI, $FR_VERT, 100, 100, 400, 300, 0, $WS_EX_CLIENTEDGE) MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Kip Posted September 7, 2008 Author Posted September 7, 2008 Registering WM_SIZING, and calling _GUIFrame_Move($iFrame_Horz, 0, 0, $iWidth, $iHeight) does the job to keep it the right size. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
ptrex Posted September 7, 2008 Posted September 7, 2008 @KipThats because, the frame control is a control. It isn't fullscreen, just a control that fills up the whole windowThis might not be the best desing, because it are the Controls in the frames thet need to be resized.A frame should best not be a control. Because the frame need store then control themselves. Like Edit, Treeview, listview Control, etc.Or am I looking at this the wrong way ?Best to post an example that contains control in the frames. This will show wether it works all together.Thanks.regards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Kip Posted September 7, 2008 Author Posted September 7, 2008 Best to post an example that contains control in the frames. This will show wether it works all together.My examples already has controls in the frames MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
ptrex Posted September 7, 2008 Posted September 7, 2008 @Kip I overlooked againg the UDF, and it lookes like you create the frames as seperate child GUI's, using "GUICreate". Which hold then the controls. Rather then the control resize relative to each other, in the main GUI. But indead it works well. It was my mistake. Didn't read through the UDF well enough. regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Kip Posted September 7, 2008 Author Posted September 7, 2008 But indead it works well. It was my mistake.Didn't read through the UDF well enough. sad.gif (joke ) MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
vaughner Posted June 1, 2009 Posted June 1, 2009 Is there always the flickering with this UDF? Seems like the thread has died but I will ask anyways. Thanks! Please click me if you have a minute! Thanks!
Authenticity Posted June 1, 2009 Posted June 1, 2009 You can move the WinMove() calls after the _IsPressed() loop and you won't see this flickering or anything at all until you release the mouse button. The problem is that WS_EX_COMPSITED can't be used with a window with either CS_OWNDC or CS_CLASSDC as stated here. I've tried to remove these class styles and was not happy when I saw the infamous BSOD, hehe.
Zedna Posted June 1, 2009 Posted June 1, 2009 Nice UDF. Resources UDF ResourcesEx UDF AutoIt Forum Search
lsakizada Posted February 8, 2010 Posted February 8, 2010 I know this is old thread but I am facing problem to close the main GUI of the example script normaly. The gui is freezing when clicking on the X button. Whats wrong. Does only me see the freeze? Be Green Now or Never (BGNN)!
Kip Posted February 10, 2010 Author Posted February 10, 2010 (edited) I know this is old thread but I am facing problem to close the main GUI of the example script normaly.The gui is freezing when clicking on the X button.Whats wrong. Does only me see the freeze?You're not the only one I made this a while ago, this didn't appear back then. I guess AutoIt has changed something over the past few years... Edited February 10, 2010 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
KaFu Posted February 10, 2010 Posted February 10, 2010 (edited) The callbacks need to be unset on exit... Add OnAutoItExitRegister("_Clean_Callbacks")at the top and Func _Clean_Callbacks() For $i = 1 To UBound($FR_FrameControls) - 1 _RegMsg_Register($FR_FrameControls[$i][1], "") Next EndFuncsomewhere down below in your functions section. Edited February 10, 2010 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
lsakizada Posted February 11, 2010 Posted February 11, 2010 The callbacks need to be unset on exit... Add OnAutoItExitRegister("_Clean_Callbacks")at the top and Func _Clean_Callbacks() For $i = 1 To UBound($FR_FrameControls) - 1 _RegMsg_Register($FR_FrameControls[$i][1], "") Next EndFuncsomewhere down below in your functions section. Hi KaFu, This still has hard crash on exit. I could not find the solution yet. Be Green Now or Never (BGNN)!
KaFu Posted February 11, 2010 Posted February 11, 2010 Really? Example in post 1 crashes for me too... this one doesn't... expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIFrame.au3> OnAutoItExitRegister("_Clean_Callbacks") $FR_CALLBACK = "FrameSizing"; Gets called when a frame is being resized $GUI = GUICreate("Splitted GUI", 600, 500) $iFrame_Vert = _GUIFrame_Create($GUI, $FR_VERT) _GUIFrame_SetMin($iFrame_Vert, 200, 250); The left frame can't be smaller than 200px, and the right frame can't be smaller than 250px _GUIFrame_First($iFrame_Vert); Switch to first frame GUICtrlCreateLabel("Left frame of the vertical frame control", 10, 10, 200, 32) $hSecondFrame = _GUIFrame_GetInfo($iFrame_Vert, $FR_SECOND); Get the handle of the second frame $iFrame_Horz = _GUIFrame_Create($hSecondFrame, $FR_HORZ); Create another frame control in a frame _GUIFrame_SetMin($iFrame_Horz, 100, 100) _GUIFrame_First($iFrame_Horz) GUICtrlCreateLabel("Upper frame of the horizontal frame control", 10, 10, 200, 32) _GUIFrame_Second($iFrame_Horz) GUISetBkColor(0x65d956) $Button = GUICtrlCreateButton("A regular button", 10, 10, 120, 23) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button MsgBox(0, "Test", "See, just a regular button") EndSwitch WEnd Func FrameSizing($iFrame, $iFirstSize, $iSecondSize) If $iFrame = $iFrame_Vert Then _GUIFrame_Move($iFrame_Horz, 0, 0, $iSecondSize) EndIf EndFunc ;==>FrameSizing Func _Clean_Callbacks() For $i = 1 To UBound($FR_FrameControls) - 1 _RegMsg_Register($FR_FrameControls[$i][1], "") Next EndFunc OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
lsakizada Posted February 12, 2010 Posted February 12, 2010 Really? Example in post 1 crashes for me too... this one doesn't...Kafu,I have seen the crash with yor fix again but then I decided to updat to current beta . (mine was 2 or three older..)I do not see the crash anymore.Thank you very very very much for your help! Now I can adopt the _GUIFrame UDF into my project. Rgards, K. Be Green Now or Never (BGNN)!
RoyS Posted September 4, 2010 Posted September 4, 2010 very useful UDF, Thank you! Have a problem though, resizing main window and the frames reduce in size but do not increase in size.. Any help available? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIFrame.au3> OnAutoItExitRegister("_Clean_Callbacks") $FR_CALLBACK = "FrameSizing"; Gets called when a frame is being resized $GUI = GUICreate("Splitted GUI", 600, 500, -1, -1, BitOR($WS_SizeBox, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)) ;_GUIFrame_Create($hWnd, $iFrameStyle, $iX=0, $iY=0, $iWidth=0, $iHeight=0, $iStyle=0, $iExStyle=0) $iFrame_Vert = _GUIFrame_Create($GUI, $FR_VERT, $FR_FRAMESTYLE) _GUIFrame_SetMin($iFrame_Vert, 200, 250); The left frame can't be smaller than 200px, and the right frame can't be smaller than 250px _GUIFrame_First($iFrame_Vert); Switch to first frame GUICtrlCreateLabel("Left frame of the vertical frame control", 10, 10, 200, 32) $hSecondFrame = _GUIFrame_GetInfo($iFrame_Vert, $FR_SECOND); Get the handle of the second frame $iFrame_Horz = _GUIFrame_Create($hSecondFrame, $FR_HORZ); Create another frame control in a frame _GUIFrame_SetMin($iFrame_Horz, 100, 100) _GUIFrame_First($iFrame_Horz) GUICtrlCreateLabel("Upper frame of the horizontal frame control", 10, 10, 200, 32) _GUIFrame_Second($iFrame_Horz) GUISetBkColor(0x65d956) $Button = GUICtrlCreateButton("A regular button", 10, 10, 120, 23) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button MsgBox(0, "Test", "See, just a regular button") EndSwitch WEnd Func FrameSizing($iFrame, $iFirstSize, $iSecondSize) If $iFrame = $iFrame_Vert Then _GUIFrame_Move($iFrame_Horz, 0, 0, $iSecondSize) EndIf EndFunc ;==>FrameSizing Func _Clean_Callbacks() For $i = 1 To UBound($FR_FrameControls) - 1 _RegMsg_Register($FR_FrameControls[$i][1], "") Next EndFunc ;==>_Clean_Callbacks
Moderators Melba23 Posted September 8, 2010 Moderators Posted September 8, 2010 RoyS and others, With Kip's kind permission, I am in the process of completely rewriting this UDF. The new version will include support for resizing the frames as the GUI resizes as well as few other new things. Keep your eyes open! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now