lgvlgv Posted July 19, 2014 Share Posted July 19, 2014 Hi all, haveing problem with howto disable one tab, is this possible to do with "_GUICtrlTab" /Lasse " Link to comment Share on other sites More sharing options...
Aphotic Posted July 19, 2014 Share Posted July 19, 2014 This may help. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 19, 2014 Moderators Share Posted July 19, 2014 (edited) lgvlgv,I do not believe you can "greyout" a tab - but you can prevent it being selected like this:expandcollapse popup#include <GUIConstantsEx.au3> Global $aTabs[5] $hGUI = GUICreate("Test", 500, 500) $cTab = GUICtrlCreateTab(10, 10, 480, 200) For $i = 0 To 4 $aTabs[$i] = GUICtrlCreateTabItem("Tab " & $i) Next GUICtrlCreateTabItem("") GUICtrlCreateLabel("Select tab to disable", 10, 230, 200, 20) $cCombo = GUICtrlCreateCombo("", 10, 250, 200, 20) GUICtrlSetData($cCombo, "0|1|2|3|4") GUISetState() $iCurrDisabledTab = -1 $iCurrTab = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCombo $iDisableTab = GUICtrlRead($cCombo) If $iDisableTab <> $iCurrDisabledTab Then If $iCurrDisabledTab <> -1 Then GUICtrlSetData($aTabs[$iCurrDisabledTab], "Tab " & $iCurrDisabledTab) EndIf GUICtrlSetData($aTabs[$iDisableTab], "Disabled") $iCurrDisabledTab = $iDisableTab EndIf Case $cTab $iSelTab = GUICtrlRead($cTab) If $iSelTab = $iCurrDisabledTab Then GUICtrlSetState($aTabs[$iCurrTab], $GUI_SHOW) Else $iCurrTab = $iSelTab EndIf EndSwitch WEndPlease ask if you have any questions. M23Edit: I see you now have 2 versions to look at! Edited July 19, 2014 by Melba23 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...
lgvlgv Posted July 19, 2014 Author Share Posted July 19, 2014 U guys are great ur example melba was just what i was looking for. the oter example was also good. Thx alot Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 19, 2014 Moderators Share Posted July 19, 2014 lgvlgv,If you did not notice - they are both mine! 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...
lgvlgv Posted July 20, 2014 Author Share Posted July 20, 2014 (edited) lgvlgv, If you did not notice - they are both mine! M23 Sorry dident see that is there a way to chane the font color on specifyed tab, that would be enuff,my problem is that i dont have a variable when creating them, it looks like this.. and i want to change the color of the name of the tab depending of some conditions Func _TCP_NewClient($iSocket, $sIP) ; We create a tab ctrl for the new client $oSrv.Send($iSocket, "~~who") ConsoleWrite("New Client!" & @CRLF) $sResult = _TCPIpToName($sIP) If @error Then ConsoleWrite( "Error: " & @error & " " & "@extended = " & @extended & @CRLF) Else ConsoleWrite($sIP & ": " & $sResult & @CRLF) EndIf $oSrv.ClientPropertySet($iSocket, 0, GUICtrlCreateTabItem($sResult)) $oSrv.ClientPropertySet($iSocket, 1, GUICtrlCreateEdit("", 12, 120, 579, 200, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL), $WS_EX_STATICEDGE)) $oSrv.ClientPropertySet($iSocket, 2, GUICtrlCreateInput("", 12, 330, 211, 21)) $oSrv.ClientPropertySet($iSocket, 3, GUICtrlCreateButton("Send", 228, 330, 75, 21)) $oSrv.ClientPropertySet($iSocket, 4, GUICtrlCreateButton("Disconnect", 312, 330, 75, 21)) GUICtrlCreateTabItem("") EndFunc ;==>_TCP_NewClient Edited July 20, 2014 by lgvlgv Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 20, 2014 Moderators Share Posted July 20, 2014 lgvlgv,The best I have ever been able to come up with is to change the background colour of the separate tabs - like this: expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiTab.au3> #include <StaticConstants.au3> ; Tab colours Global $aTabColours[4] = [0xFFC0C0, 0xC0FFC0, 0xC0C0FF, 0xC0C0C0] ; Create GUI Global $hGUI = GUICreate ("Test", 400,300) GUISetBkColor (0) ; Create label to cover tab "tab" Global $cColourTab = GUICtrlCreateLabel("", 0, 0, 1, 1, BitOR($SS_NOTIFY, $SS_CENTER, $SS_SUNKEN)) ; Create tab Global $cTab = GUICtrlCreateTab(5, 5,390, 290) Global $cTab_Handle = GUICtrlGetHandle($cTab) ; Create tab items and colour them For $i = 0 To 3 GUICtrlCreateTabItem ("Tab item - " & $i) _GUICtrlTab_SetBkColor($hGUI, $cTab, $aTabColours[$i]) GUICtrlCreateTabItem ("") Next _GUICtrlTab_SetCurSel($cTab_Handle,0) _GUICtrlTab_SetCurFocus($cTab_Handle,0) TabEvent() GUISetState () While 1 Switch GUIGetMsg () Case $GUI_EVENT_CLOSE Exit Case $cTab TabEvent() EndSwitch WEnd Func TabEvent() ; Set values Local $iTab_X = 5, $iTab_Y = 5, $iTab_Margin = 1 ; Get index of current tab Local $iTab_Index = GUICtrlRead($cTab) ; Get coordinates of TabItem Local $aTab_Coord = _GUICtrlTab_GetItemRect($cTab_Handle, $iTab_Index) ; Get text of TabItem Local $sTab_Text = _GUICtrlTab_GetItemText($cTab_Handle, $iTab_Index) ; Place label GUICtrlSetPos($cColourTab, $iTab_X + $aTab_Coord[0] + $iTab_Margin, $iTab_Y + $aTab_Coord[1] + $iTab_Margin, $aTab_Coord[2] - $aTab_Coord[0] - ($iTab_Margin * 2), $aTab_Coord[3] - $aTab_Coord[1] - ($iTab_Margin * 2) + 5) ; Set text GUICtrlSetData($cColourTab, $sTab_Text) ; Set colour GUICtrlsetBkColor ($cColourTab,$aTabColours[$iTab_Index] ) ; Set focus _GUICtrlTab_SetCurFocus($cTab_Handle,$iTab_Index) EndFunc Func _GUICtrlTab_SetBkColor($cWnd, $cSysTab32, $sBkColor) ; Get tab position Local $aTabPos = ControlGetPos($cWnd, "", $cSysTab32) ; Get size of user area Local $aTab_Rect = _GUICtrlTab_GetItemRect($cSysTab32, -1) ; Create label GUICtrlCreateLabel("", $aTabPos[0] + 2, $aTabPos[1] + $aTab_Rect[3] + 4, $aTabPos[2] - 6, $aTabPos[3] - $aTab_Rect[3] - 7) ; Colour label GUICtrlSetBkColor(-1, $sBkColor) ; Disable label GUICtrlSetState(-1, $GUI_DISABLE) EndFunc ;==>_GUICtrlTab_SetBkColorM23 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...
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