iCode Posted November 3, 2011 Share Posted November 3, 2011 I'm trying to make the width of the tabs in a tab control match the width of the tab control $TCS_RAGGEDRIGHT 0x0800 Rows of tabs will not be stretched to fill the entire width of the control. This style is the default. According to my understanding, if yoiu add $TCS_RAGGEDRIGHT to a tab control, then the tabs should expand in width to match the width of the tab control, however they don't (i see no difference in adding $TCS_RAGGEDRIGH) . Am i missing something? This is on Win7 #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Local $Form = GUICreate("Form1", 623, 449, 644, 114) Local $Tab = GUICtrlCreateTab(8, 8, 157, 53, $TCS_RAGGEDRIGHT) ;Local $Tab = GUICtrlCreateTab(8, 8, 157, 53) Local $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") Local $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width) Link to comment Share on other sites More sharing options...
iCode Posted November 20, 2011 Author Share Posted November 20, 2011 anyone? FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 20, 2011 Moderators Share Posted November 20, 2011 iCode, According to my understanding, if yoiu add $TCS_RAGGEDRIGHT to a tab control, then the tabs should expand in width to match the width of the tab controlRead the definition that you yourself provided: "$TCS_RAGGEDRIGHT 0x0800 Rows of tabs will not be stretched to fill the entire width of the control. This style is the default. As I read that, the $TCS_RAGGEDRIGHT style will do exactly the opposite of what you think. If you want the tab headers to expand to fill all the space across the tab control you need the $TCS_RIGHTJUSTIFY style: "The width of each tab is increased, if necessary, so that each row of tabs fills the entire width of the tab control." But note the caveat that you must also specify the TCS_MULTILINE style - so it seems you cannot apply the $TCS_RIGHTJUSTIFY style to a single row of tab headers. My tests indicate that $TCS_RIGHTJUSTIFY is set as default when you add the TCS_MULTILINE style - look at this test script which show the style value applied in each case: expandcollapse popup#include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> $hGUI = GUICreate("Normal", 500, 500) $hTab = GUICtrlCreateTab(10, 10, 200, 200) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") $hLabel = GUICtrlCreateLabel("", 10, 300, 200, 20) GUISetState(@SW_SHOW) GUICtrlSetData($hLabel, "0x" & Hex(_WinAPI_GetWindowLong(GUICtrlGetHandle($hTab), $GWL_STYLE), 6)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd $hGUI = GUICreate("Right Justify", 500, 500) $hTab = GUICtrlCreateTab(10, 10, 200, 200, $TCS_RIGHTJUSTIFY) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") $hLabel = GUICtrlCreateLabel("", 10, 300, 200, 20) GUISetState(@SW_SHOW) GUICtrlSetData($hLabel, "0x" & Hex(_WinAPI_GetWindowLong(GUICtrlGetHandle($hTab), $GWL_STYLE), 6)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd $hGUI = GUICreate("Right Justify & Multi Line", 500, 500) $hTab = GUICtrlCreateTab(10, 10, 200, 200, BitOR($TCS_RIGHTJUSTIFY, $TCS_MULTILINE)) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("TabSheet3") GUICtrlCreateTabItem("TabSheet4") GUICtrlCreateTabItem("") $hLabel = GUICtrlCreateLabel("", 10, 300, 200, 20) GUISetState(@SW_SHOW) GUICtrlSetData($hLabel, "0x" & Hex(_WinAPI_GetWindowLong(GUICtrlGetHandle($hTab), $GWL_STYLE), 6)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd $hGUI = GUICreate("Ragged Right & Multi Line", 500, 500) $hTab = GUICtrlCreateTab(10, 10, 200, 200, BitOR($TCS_RAGGEDRIGHT, $TCS_MULTILINE)) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("TabSheet3") GUICtrlCreateTabItem("TabSheet4") GUICtrlCreateTabItem("") $hLabel = GUICtrlCreateLabel("", 10, 300, 200, 20) GUISetState(@SW_SHOW) GUICtrlSetData($hLabel, "0x" & Hex(_WinAPI_GetWindowLong(GUICtrlGetHandle($hTab), $GWL_STYLE), 6)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd $hGUI = GUICreate("Multi Line alone", 500, 500) $hTab = GUICtrlCreateTab(10, 10, 200, 200, $TCS_MULTILINE) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("TabSheet3") GUICtrlCreateTabItem("TabSheet4") GUICtrlCreateTabItem("") $hLabel = GUICtrlCreateLabel("", 10, 300, 200, 20) GUISetState(@SW_SHOW) GUICtrlSetData($hLabel, "0x" & Hex(_WinAPI_GetWindowLong(GUICtrlGetHandle($hTab), $GWL_STYLE), 6)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd So it seems you cannot get a single row of tabs to fill the width of the entire tab control. Pity! 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 Link to comment Share on other sites More sharing options...
martin Posted November 20, 2011 Share Posted November 20, 2011 #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> $tabControlwidth = 157 Local $Form = GUICreate("Form1", 623, 449, 644, 114) Local $Tab = GUICtrlCreateTab(8, 8, $tabControlwidth, 53, $TCS_FIXEDWIDTH); must have fixed width if you want to set the tab widths ;Local $Tab = GUICtrlCreateTab(8, 8, 157, 53) Local $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") Local $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) GUICtrlSendMsg($Tab, $TCM_SETITEMSIZE, 0, _MakeLong(int($tabControlwidth/2) - 2, 20));Might need some experimenting on different OS/ theme? While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _MakeLong($l, $h) Return BitOR(BitAND($l, 0xFFFF), BitShift(BitAND($h, 0xFFFF), -16)) EndFunc ;==>_MakeLong Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 20, 2011 Moderators Share Posted November 20, 2011 martin, Thanks for that. Goes straight into the snippets folder. 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 Link to comment Share on other sites More sharing options...
martin Posted November 20, 2011 Share Posted November 20, 2011 Snippets folder? I hope you're not Jewish! Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 20, 2011 Moderators Share Posted November 20, 2011 martin, How very un-PC! And how very funny! But not true! 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 Link to comment Share on other sites More sharing options...
iCode Posted November 20, 2011 Author Share Posted November 20, 2011 thanks guys reading the doc though leads me to believe that if you add $TCS_RIGHTJUSTIFY and $TCS_MULTILINE, you'll stretch the tabs, but this is not the case unless you actually have more than 1 row of tabs @martin - LOL - took me a minute to grasp that one FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width) Link to comment Share on other sites More sharing options...
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