jasty Posted February 19, 2020 Posted February 19, 2020 I have a tab control as the main content of my tool and am struggling a bit with how to handle the multi lines. Controls inside the tab control are not shifting when the number of lines is changed due to resizing and when there are 3 or more header rows they are overlapping with the tabs. First off is there any automatic way to shift the controls? I am trying the manual route by using _GUICtrlTab_GetDisplayRect in a WM_MOVE handler so that I know how far the controls have to be shifted but there doesnt seem to be a good way to move the controls. When I use ControlMove it conflicts with AutoIt's automatic resizing since I am using GUICtrlSetResizing on all of the controls and if I use GUICtrlSetPos through AutoIt it causes AutoIt to forget the initial layout position while resizing causing controls to shift slightly and the errors accumulate rapidly misaligning everything. Am I missing something easy? Is there any layout engine in autoit that can handle multi line tabs gracefully?
Nine Posted February 19, 2020 Posted February 19, 2020 How about you provide some code so we can understand what you are after ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
jasty Posted February 19, 2020 Author Posted February 19, 2020 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <GuiTab.au3> #include <GuiConstants.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> global $CLIENT_RECT Func Example() global $hGUI = GUICreate("TABs", 310, 428 , Default, Default, BitOr($WS_SIZEBOX,$WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SYSMENU )) global $hTabs = GUICtrlCreateTab(10, 35, 292, 360, $TCS_MULTILINE) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) for $i = 0 to 10 GUICtrlCreateTabItem("TAB"&$i) $y = 75 for $j = 0 to 10 GUICtrlCreateButton("Button"&$i&"-"&$j, 20 + Mod($j, 4)*70, $y, 60, 30) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKHEIGHT) if Mod($j, 4) == 3 Then $y += 40 EndIf next Next GUICtrlCreateTabItem("") global $lastControl = GUICtrlCreateLabel("Resizing this window back and forth a few times", 10, 15) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKHEIGHT) $CLIENT_RECT = _GUICtrlTab_GetDisplayRect(GUICtrlGetHandle($hTabs)) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Exit EndFunc ;==>Example GUIRegisterMsg($WM_SIZE, 'WM_SIZE') Func WM_SIZE($hWnd, $iMsg, $iWParam, $iLParam) If $hwnd == $hGUI then $rect = _GUICtrlTab_GetDisplayRect(GUICtrlGetHandle($hTabs)) $tabHeightAdjust = $rect[1] - $CLIENT_RECT[1] if $tabHeightAdjust <> 0 Then for $i = ($hTabs +1) to ($lastControl -1) $pos = ControlGetPos($hGUI, "", GUICtrlGetHandle($i)) GuiCtrlSetPos($i, Default, $pos[1] + $tabHeightAdjust) Next $CLIENT_RECT = $rect Endif EndIf return $GUI_RUNDEFMSG endfunc Example() Edited February 19, 2020 by jasty
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