jaberwacky Posted October 21 Posted October 21 (edited) Hello, I'm trying to make a form window that is constrained within another form (inside of the red square). I've tried so many different things that I can't remember now. Is it possible? Edit: I'm thinking maybe a watch dog that will stop movement of the window once it reaches the boundary? But then again, I'd like for the window to be cut off by the tab if it moves too far to the right or bottom. The code if you'd like to see it: expandcollapse popup#include-once Opt("WinTitleMatchMode", 4) ; advanced Opt("MouseCoordMode", 2) #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> Global Const $main_width = 815 Global Const $main_height = 860 Global Const $main_left = (@DesktopWidth / 2) - ($main_width / 2) Global Const $main_top = (@DesktopHeight / 2) - ($main_height / 2) Global Const $guiCanvas = GuiCreate("GUI Canvas", $main_width, $main_height, $main_left, $main_top) GUISetFont(10, -1, -1, "Segoe UI", $guiCanvas) #Region menu items Global Const $menu_file = GUICtrlCreateMenu ("File") Global Const $menu_save_definition = GUICtrlCreateMenuitem("Save", $menu_file) ; Roy add-on Global Const $menu_load_definition = GUICtrlCreateMenuitem("Load", $menu_file) ; Roy add-on GUICtrlCreateMenuitem('' , $menu_file) ; Roy add-on Global Const $menu_exit = GUICtrlCreateMenuitem("Exit", $menu_file) Global Const $menu_edit = GUICtrlCreateMenu ("Edit") Global Const $menu_vals = GUICtrlCreateMenuitem("Vals" , $menu_edit) ; added by: TheSaint Global Const $menu_wipe = GUICtrlCreateMenuitem("Clear All Controls", $menu_edit) Global Const $menu_about = GUICtrlCreateMenuitem("About" , $menu_edit) ; added by: TheSaint GUICtrlSetState($menu_wipe, $GUI_DISABLE) Global Const $menu_settings = GUICtrlCreateMenu ("Settings") Global Const $menu_show_grid = GUICtrlCreateMenuItem("Show grid" , $menu_settings) Global Const $menu_grid_snap = GUICtrlCreateMenuItem("Snap to grid" , $menu_settings) Global Const $menu_paste_pos = GUICtrlCreateMenuItem("Paste at mouse position" , $menu_settings) Global Const $menu_show_ctrl = GUICtrlCreateMenuItem("Show control when moving", $menu_settings) Global Const $menu_show_hidden = GUICtrlCreateMenuItem("Show hidden controls" , $menu_settings) GUICtrlSetState($menu_show_grid , $GUI_CHECKED ) GUICtrlSetState($menu_grid_snap , $GUI_CHECKED ) GUICtrlSetState($menu_paste_pos , $GUI_CHECKED ) GUICtrlSetState($menu_show_ctrl , $GUI_CHECKED ) GUICtrlSetState($menu_show_hidden, $GUI_UNCHECKED) #EndRegion menu items #Region toolbar Global Const $default_cursor = CreateToolButton("Cursor" , 5, 5) Global Const $toolTab = CreateToolButton("Tab" , 45, 5) Global Const $toolGroup = CreateToolButton("Group" , 5, 45) Global Const $toolButton = CreateToolButton("Button" , 45, 45) Global Const $toolCheckbox = CreateToolButton("Checkbox" , 5, 85) Global Const $toolRadio = CreateToolButton("Radio" , 45, 85) Global Const $toolEdit = CreateToolButton("Edit" , 5, 125) Global Const $toolInput = CreateToolButton("Input" , 45, 125) Global Const $toolLabel = CreateToolButton("Label" , 5, 165) Global Const $toolUpDown = CreateToolButton("UpDown" , 45, 165) Global Const $toolList = CreateToolButton("List" , 5, 205) Global Const $toolCombo = CreateToolButton("Combo" , 45, 205) Global Const $toolDate = CreateToolButton("Date" , 5, 245) Global Const $toolTreeview = CreateToolButton("Treeview" , 45, 245) Global Const $toolProgress = CreateToolButton("Progress" , 5, 285) Global Const $toolAvi = CreateToolButton("Avi" , 45, 285) Global Const $toolIcon = CreateToolButton("Icon" , 5, 325) Global Const $toolPic = CreateToolButton("Pic" , 45, 325) Global Const $toolSlider = CreateToolButton("Slider" , 5, 365) Global Const $toolMenu = CreateToolButton("Menu" , 45, 365) Global Const $toolContextMenu = CreateToolButton("Context Menu", 5, 405) Global Const $toolForm = CreateToolButton("Form" , 45, 405) #EndRegion toolbar GUICtrlCreateTab(95, 5, $main_width - 105, $main_height - 35) GUICtrlCreateTabItem("Form 1") GUICtrlCreateTabItem("Form 2") GUISetState(@SW_SHOWNORMAL) Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Until False Func CreateToolButton(Const $name, Const $left, Const $top) Local Const $tool = GUICtrlCreateRadio($name, $left, $top, 40, 40, BitOR($BS_PUSHLIKE, $BS_ICON)) GUICtrlSetImage($tool, @ScriptDir & "\resources\Icons\" & $name & ".ico") GUICtrlSetTip($tool, $name) Return $tool EndFunc Edited October 21 by jaberwacky Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
Solution ioa747 Posted October 22 Solution Posted October 22 but I couldn't put it in the Tab control But as a thought if you want, you could replace the Tabs with buttons, which would represent the "pages", and depending on which button you pressed, the objects that don't belong to the "page" would be hidden, and the ones that belong to the "page" would be displayed ... ;~ GUICtrlCreateTab(95, 5, $main_width - 105, $main_height - 35) ;~ GUICtrlCreateTabItem("Form 1") ;~ GUICtrlCreateTabItem("Form 2") GUISetState(@SW_SHOWNORMAL) Global Const $hChildWnd = GuiCreate("ChildWnd", 400, 200, 100, 10, BitOR($WS_CHILD, $WS_OVERLAPPEDWINDOW), -1, $toolbar) GUISetState(@SW_SHOWNORMAL, $hChildWnd) ... jaberwacky 1 I know that I know nothing
argumentum Posted October 22 Posted October 22 5 hours ago, jaberwacky said: I'm trying to make a form window that is constrained within another form (inside of the red square). Why not Koda like ? That will be easier for you and the user 🤔 My 2 cents. jaberwacky 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
jaberwacky Posted October 22 Author Posted October 22 18 hours ago, argumentum said: Why not Koda like ? That will be easier for you and the user 🤔 My 2 cents. But see that would make too much sense! argumentum 1 Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
jaberwacky Posted October 22 Author Posted October 22 22 hours ago, ioa747 said: but I couldn't put it in the Tab control But as a thought if you want, you could replace the Tabs with buttons, which would represent the "pages", and depending on which button you pressed, the objects that don't belong to the "page" would be hidden, and the ones that belong to the "page" would be displayed Tremendous! Thank you, this gives me something to tinker with! ioa747 and argumentum 2 Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
jaberwacky Posted October 23 Author Posted October 23 (edited) Progress! ... Click the form button beside of the cursor button (more than once if you want to). Now the windows are clipped to the left too! expandcollapse popup#include-once Opt("WinTitleMatchMode", 4) ; advanced Opt("MouseCoordMode" , 2) #include <WindowsStylesConstants.au3> #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> Global $formList[], $formCount = 0 Global Const $main_width = 815 Global Const $main_height = 860 Global Const $main_left = (@DesktopWidth / 2) - ($main_width / 2) Global Const $main_top = (@DesktopHeight / 2) - ($main_height / 2) Global Const $guiCanvas = GuiCreate("GUI Canvas", $main_width, $main_height, $main_left, $main_top) Global Const $canvas = GuiCreate('', ($main_width - 105), ($main_height - 35), 95, 5, $WS_CHILD, $WS_EX_OVERLAPPEDWINDOW, $guiCanvas) GUISetFont(10, -1, -1, "Segoe UI", $guiCanvas) #region ; menu items Global Const $menu_file = GUICtrlCreateMenu ("File") Global Const $menu_save_definition = GUICtrlCreateMenuitem("Save", $menu_file) ; Roy add-on Global Const $menu_load_definition = GUICtrlCreateMenuitem("Load", $menu_file) ; Roy add-on GUICtrlCreateMenuitem('' , $menu_file) ; Roy add-on Global Const $menu_exit = GUICtrlCreateMenuitem("Exit", $menu_file) Global Const $menu_edit = GUICtrlCreateMenu ("Edit") Global Const $menu_vals = GUICtrlCreateMenuitem("Vals" , $menu_edit) ; added by: TheSaint Global Const $menu_wipe = GUICtrlCreateMenuitem("Clear all controls", $menu_edit) Global Const $menu_about = GUICtrlCreateMenuitem("About" , $menu_edit) ; added by: TheSaint GUICtrlSetState($menu_wipe, $GUI_DISABLE) Global Const $menu_settings = GUICtrlCreateMenu ("Settings") Global Const $menu_show_grid = GUICtrlCreateMenuItem("Show grid" , $menu_settings) Global Const $menu_grid_snap = GUICtrlCreateMenuItem("Snap to grid" , $menu_settings) Global Const $menu_paste_pos = GUICtrlCreateMenuItem("Paste at mouse position" , $menu_settings) Global Const $menu_show_ctrl = GUICtrlCreateMenuItem("Show control when moving", $menu_settings) Global Const $menu_show_hidden = GUICtrlCreateMenuItem("Show hidden controls" , $menu_settings) GUICtrlSetState($menu_show_grid , $GUI_CHECKED ) GUICtrlSetState($menu_grid_snap , $GUI_CHECKED ) GUICtrlSetState($menu_paste_pos , $GUI_CHECKED ) GUICtrlSetState($menu_show_ctrl , $GUI_CHECKED ) GUICtrlSetState($menu_show_hidden, $GUI_UNCHECKED) #endregion ; menu items #region ; toolbar Global Const $default_cursor = CreateToolButton("Cursor" , 5, 5) Global Const $toolForm = CreateToolButton("Form" , 45, 5) Global Const $toolGroup = CreateToolButton("Group" , 5, 45) Global Const $toolButton = CreateToolButton("Button" , 45, 45) Global Const $toolCheckbox = CreateToolButton("Checkbox" , 5, 85) Global Const $toolRadio = CreateToolButton("Radio" , 45, 85) Global Const $toolEdit = CreateToolButton("Edit" , 5, 125) Global Const $toolInput = CreateToolButton("Input" , 45, 125) Global Const $toolLabel = CreateToolButton("Label" , 5, 165) Global Const $toolUpDown = CreateToolButton("UpDown" , 45, 165) Global Const $toolList = CreateToolButton("List" , 5, 205) Global Const $toolCombo = CreateToolButton("Combo" , 45, 205) Global Const $toolDate = CreateToolButton("Date" , 5, 245) Global Const $toolTreeview = CreateToolButton("Treeview" , 45, 245) Global Const $toolProgress = CreateToolButton("Progress" , 5, 285) Global Const $toolAvi = CreateToolButton("Avi" , 45, 285) Global Const $toolIcon = CreateToolButton("Icon" , 5, 325) Global Const $toolPic = CreateToolButton("Pic" , 45, 325) Global Const $toolSlider = CreateToolButton("Slider" , 5, 365) Global Const $toolMenu = CreateToolButton("Menu" , 45, 365) Global Const $toolContextMenu = CreateToolButton("Context Menu", 5, 405) Global Const $toolTab = CreateToolButton("Tab" , 45, 405) #endregion ; toolbar main() Func main() GUISetState(@SW_SHOWNORMAL, $guiCanvas) GUISetState(@SW_SHOWNORMAL, $canvas) Local $msg Do $msg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $msg[1] Case $guiCanvas Switch $msg[0] Case $toolForm CreateForm() Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch Until False EndFunc Func CreateForm() GUISwitch($canvas) $formCount += 1 Local Const $form = GuiCreate("Form " & $formCount, 400, 600, 5, 5, BitOR($WS_CHILD, $WS_OVERLAPPEDWINDOW), -1, $canvas) $formList["Form" & $formCount] = $form GUISetState(@SW_SHOWNORMAL, $form) GUISwitch($guiCanvas) Return $form EndFunc Func CreateToolButton(Const $name, Const $left, Const $top) Local Const $tool = GUICtrlCreateRadio($name, $left, $top, 40, 40, BitOR($BS_PUSHLIKE, $BS_ICON)) GUICtrlSetImage($tool, @ScriptDir & "\resources\Icons\" & $name & ".ico") GUICtrlSetTip($tool, $name) Return $tool EndFunc Edited October 23 by jaberwacky Gianni, ioa747 and argumentum 3 Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
jaberwacky Posted October 27 Author Posted October 27 On 10/22/2025 at 12:40 AM, argumentum said: Why not Koda like ? That will be easier for you and the user 🤔 My 2 cents. Dang, I think you're right. Because the window in GUIscape has different styles than a native window. I'm not sure if this will not allow the styles to be set correctly when designing a GUI in GUIscape. 😔 ; Regular WS_BORDER True WS_POPUP True WS_CAPTION True WS_CLIPCHILDREN False WS_CLIPSIBLINGS True WS_DISABLED False WS_DLGFRAME True WS_HSCROLL False WS_MAXIMIZE False WS_MAXIMIZEBOX False WS_OVERLAPPED False WS_OVERLAPPEDWINDOW True WS_POPUPWINDOW True WS_SIZEBOX False WS_SYSMENU True WS_THICKFRAME False WS_VSCROLL False WS_VISIBLE True WS_CHILD False WS_GROUP True WS_TABSTOP False DS_MODALFRAME False DS_SETFOREGROUND False DS_CONTEXTHELP False ; GUIScape WS_BORDER True WS_POPUP False WS_CAPTION True WS_CLIPCHILDREN False WS_CLIPSIBLINGS False WS_DISABLED False WS_DLGFRAME True WS_HSCROLL False WS_MAXIMIZE False WS_MAXIMIZEBOX False WS_OVERLAPPED False WS_OVERLAPPEDWINDOW True WS_POPUPWINDOW True WS_SIZEBOX False WS_SYSMENU True WS_THICKFRAME False WS_VSCROLL False WS_VISIBLE True WS_CHILD True WS_GROUP False WS_TABSTOP False DS_MODALFRAME True DS_SETFOREGROUND False DS_CONTEXTHELP False Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
jaberwacky Posted October 27 Author Posted October 27 (edited) Well, I dunno, might not be as bad as I thought ... expandcollapse popup#include <WindowsStylesConstants.au3> #include <GUIConstantsEx.au3> Global $form = GUICreate("Form", 300, 300) GUISetStyle($WS_BORDER, -1, $form) GUISetState(@SW_SHOW, $form) Global $styles = GUIGetStyle($form) Local Const $allStyles[] = [$WS_BORDER, _ $WS_POPUP, _ $WS_CAPTION, _ $WS_CLIPCHILDREN, _ $WS_CLIPSIBLINGS, _ $WS_DISABLED, _ $WS_DLGFRAME, _ $WS_HSCROLL, _ $WS_MAXIMIZE, _ $WS_MAXIMIZEBOX, _ $WS_OVERLAPPED, _ $WS_OVERLAPPEDWINDOW, _ $WS_POPUPWINDOW, _ $WS_SIZEBOX, _ $WS_SYSMENU, _ $WS_THICKFRAME, _ $WS_VSCROLL, _ $WS_VISIBLE, _ $WS_CHILD, _ $WS_GROUP, _ $WS_TABSTOP, _ $DS_MODALFRAME, _ $DS_SETFOREGROUND, _ $DS_CONTEXTHELP] Local Const $names[] = ["WS_BORDER " , _ "WS_POPUP " , _ "WS_CAPTION " , _ "WS_CLIPCHILDREN " , _ "WS_CLIPSIBLINGS " , _ "WS_DISABLED " , _ "WS_DLGFRAME " , _ "WS_HSCROLL " , _ "WS_MAXIMIZE " , _ "WS_MAXIMIZEBOX " , _ "WS_OVERLAPPED " , _ "WS_OVERLAPPEDWINDOW" , _ "WS_POPUPWINDOW " , _ "WS_SIZEBOX " , _ "WS_SYSMENU " , _ "WS_THICKFRAME " , _ "WS_VSCROLL " , _ "WS_VISIBLE " , _ "WS_CHILD " , _ "WS_GROUP " , _ "WS_TABSTOP " , _ "DS_MODALFRAME " , _ "DS_SETFOREGROUND " , _ "DS_CONTEXTHELP "] Local Const $upBound = UBound($allStyles) For $i = 0 To $upBound - 1 If BitAND($styles[0], $allStyles[$i]) Then ConsoleWrite($names[$i] & " True" & @CRLF) Else ConsoleWrite($names[$i] & " False" & @CRLF) EndIf Next Do If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit EndIf Until False Edited October 27 by jaberwacky Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
jaberwacky Posted October 28 Author Posted October 28 (edited) Oh man, I was forgetting to not over write the default styles. DOH! ............. On second thought, I'm not sure that's the issue either. Oh well, I'll keep tinkering. I'm sure I can find a solution. Edited October 28 by jaberwacky argumentum 1 Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
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