Sign in to follow this  
Followers 0
iCode

TCS_RAGGEDRIGHT doesn't work?

8 posts in this topic

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)

Share this post


Link to post
Share on other sites



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 control

Read 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. :D

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:

#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! :oops:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#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.

Share this post


Link to post
Share on other sites

martin,

Thanks for that. Goes straight into the snippets folder. :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

martin,

How very un-PC! :D

And how very funny! :rip:

But not true! :oops:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 :D


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)

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
Sign in to follow this  
Followers 0