Polyphem Posted July 16, 2008 Share Posted July 16, 2008 HiHo, recently changed the style of a Tab control to $TCS_BUTTONS (i like that style muttley ). But now i cant find a way to properly set focus to the tab anymore, with _GUICtrlTab_SetCurFocus($tab, 1) the button is pressed but the tabs content is not displayed. Anyone got a hint for me? Cheers This post will be edited again by Polyphem: Tomorrow, 11:55 AM Link to comment Share on other sites More sharing options...
rasim Posted July 17, 2008 Share Posted July 17, 2008 PolyphemTo select a tab use the _GUICtrlTab_SetCurSel() function. Link to comment Share on other sites More sharing options...
Polyphem Posted July 17, 2008 Author Share Posted July 17, 2008 (edited) @rasim: Thanks for your reply. But _GUICtrlTab_SetCurFocus($tab, 1) is what did the trick for me on a Tab control without the $TCS_BUTTONS style set. Tried that AND _GUICtrlTab_SetCurSel($tab, 1) both on the style, neither works. Below is a sample code. GUI one behaves like i want, GUI two doesnt. The only difference between the two functions is the tab style... expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiTab.au3> Example_Tab_without_TCS_BUTTONS() Example_Tab_with_TCS_BUTTONS() Func Example_Tab_without_TCS_BUTTONS() GUICreate("My GUI Tab", 250, 150) $tab = GUICtrlCreateTab(10, 10, 200, 100) $tab0 = GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) $tab1 = GUICtrlCreateTabItem("tab1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) $tab2 = GUICtrlCreateTabItem("tab2") GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUISetState() _GUICtrlTab_SetCurFocus($tab, 1) ;_GUICtrlTab_SetCurSel($tab, 1) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop GUIDelete (-1) endif WEnd EndFunc Func Example_Tab_with_TCS_BUTTONS() GUICreate("My GUI Tab", 250, 150) $tab = GUICtrlCreateTab(10, 10, 200, 100,$TCS_BUTTONS) $tab0 = GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) $tab1 = GUICtrlCreateTabItem("tab1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) $tab2 = GUICtrlCreateTabItem("tab2") GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUISetState() _GUICtrlTab_SetCurFocus($tab, 1) ;_GUICtrlTab_SetCurSel($tab, 1) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop GUIDelete (-1) endif WEnd EndFunc Thanks for your reply, maybe someone else got a hint? Cheers Poly Edit: Tweaked the code a little... Edited July 17, 2008 by Polyphem This post will be edited again by Polyphem: Tomorrow, 11:55 AM Link to comment Share on other sites More sharing options...
smashly Posted July 17, 2008 Share Posted July 17, 2008 Is there any reason your not using GUICtrlSetState($tab1, $GUI_SHOW) ? Link to comment Share on other sites More sharing options...
Polyphem Posted July 17, 2008 Author Share Posted July 17, 2008 Ehhhhh, yes.... i didnt know that that function works on tabs muttley... but it does , thanks for the reply m8! expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiTab.au3> Example_Tab_without_TCS_BUTTONS() Example_Tab_with_TCS_BUTTONS() Func Example_Tab_without_TCS_BUTTONS() GUICreate("My GUI Tab", 250, 150) $tab = GUICtrlCreateTab(10, 10, 200, 100) $tab0 = GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) $tab1 = GUICtrlCreateTabItem("tab1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) $tab2 = GUICtrlCreateTabItem("tab2") GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUISetState() ;_GUICtrlTab_SetCurFocus($tab, 1) ;_GUICtrlTab_SetCurSel($tab, 1) GUICtrlSetState($tab1, $GUI_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop GUIDelete (-1) endif WEnd EndFunc Func Example_Tab_with_TCS_BUTTONS() GUICreate("My GUI Tab", 250, 150) $tab = GUICtrlCreateTab(10, 10, 200, 100,$TCS_BUTTONS) $tab0 = GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) $tab1 = GUICtrlCreateTabItem("tab1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) $tab2 = GUICtrlCreateTabItem("tab2") GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUISetState() ;_GUICtrlTab_SetCurFocus($tab, 1) ;_GUICtrlTab_SetCurSel($tab, 1) GUICtrlSetState($tab1, $GUI_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop GUIDelete (-1) endif WEnd EndFunc This post will be edited again by Polyphem: Tomorrow, 11:55 AM Link to comment Share on other sites More sharing options...
smashly Posted July 17, 2008 Share Posted July 17, 2008 Your welcome 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