Wooltown Posted March 8, 2006 Share Posted March 8, 2006 Hello ! How do I create a GUI Controller on a previosuly used Tab. I have created Tab 1, Tab 2 and Tab 3, then I wan't to create a controller on Tab 1, how do I change to set focus on Tab 1 to create the controller there. /Sven Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 8, 2006 Moderators Share Posted March 8, 2006 (edited) expandcollapse popup#include <GUIConstants.au3> GUICreate("My GUI Tab"); will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $tab=GUICtrlCreateTab (10,10, 200,100) $tab0=GUICtrlCreateTabitem ("tab0") GUICtrlCreateLabel ("label0", 30,80,50,20) $tab0OK=GUICtrlCreateButton ("OK0", 20,50,50,20) $tab0input=GUICtrlCreateInput ("default", 80,50,70,20) $tab1=GUICtrlCreateTabitem ( "tab----1") GUICtrlCreateLabel ("label1", 30,80,50,20) $tab1combo=GUICtrlCreateCombo ("", 20,50,60,40) GUICtrlSetData(-1,"Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon $tab1OK=GUICtrlCreateButton ("OK1", 80,50,50,20) $tab2=GUICtrlCreateTabitem ("tab2") GUICtrlCreateLabel ("label2", 30,80,50,20) $tab2OK=GUICtrlCreateButton ("OK2", 140,50,50) GUICtrlCreateTabitem ("") ; end tabitem definition GUICtrlCreateLabel ("label3", 20,130,50,20) GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $tab0OK Then GUICtrlSetState($tab1, $GUI_SHOW) WendClick the button, and it will focus now on tab 2 with GUICtrlSetState() Edit: P.S. - I got this Tab example from the help file... it actually has you question answered right in it... when you start the GUI in the GUICtrlCreateTab() section of the Help File, there it shows tab 3 first... it uses GUICtrlSetState(-1, $GUI_SHOW), I altered my example to show you how you could do it with a button. Edited March 8, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Wooltown Posted March 8, 2006 Author Share Posted March 8, 2006 Thanks, but if I create a Button for example it will show up on all TABs, not just the one I set focus on. /sven Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 8, 2006 Moderators Share Posted March 8, 2006 (edited) You don't need a button to do it, I was merely showing you how it could be done... you could simply make it a conditional statement if you want too. Edit: This does not show the 'Same' Button, because we are using TabItem after Tab#include <guiconstants.au3> $TestGUI = GUICreate('Testing', 200, 100) $TAB = GUICtrlCreateTab(0, 0, 200, 100) $TABITEM1 = GUICtrlCreateTabItem('TAB 1') $TABBUTTON1 = GUICtrlCreateButton('BUTTON FOR TAB 1', 10, 30, 120, 30) $TABITEM2 = GUICtrlCreateTabItem('TAB 2') $TABBUTTON2 = GUICtrlCreateButton('BUTTON FOR TAB 2', 75, 65, 120, 30); DIFFERENT POSITION SO YOU CAN SEE THE DIFFERENCE GUISetState() While 1 $MSG = GUIGetMsg() If $MSG = - 3 Then Exit If $MSG = $TABBUTTON1 Then GUICtrlSetState($TABITEM2, $GUI_SHOW) If $MSG = $TABBUTTON2 Then GUICtrlSetState($TABITEM1, $GUI_SHOW) WEnd Edited March 8, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Wooltown Posted March 8, 2006 Author Share Posted March 8, 2006 I don't think you really understand the problem, If I have an event, that triggers on a button located on tab1, and that event creates a new GUICtrlCreatebutton that should be located on TAB1, it will show up on all TABs, not only the first. /Sven Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 8, 2006 Moderators Share Posted March 8, 2006 (edited) Well, I've seem to have done something you haven't.. supplied code... want to try and give that a shot... I'm pretty sure if you use the example I provided above, you'll see in fact that your response is not the case... unless you are recreating buttons etc... Edit: I think I jumped the gun a bit myself, after reading your post over and over a few times.... Edit2: I tried all the functions in the help file... unless GaFrost/Cyber/Larry or any other Dev has an Idea, I'm clueless... The only thing I could do was destroy and recreate.... Sorry for mis-understanding your post. Edited March 8, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 8, 2006 Moderators Share Posted March 8, 2006 (edited) Ok, I take back my last edit... "I thought I tried everything", is this what you are looking for?#include <GUIConstants.au3> Local $TABBUTTON[10] $TestGUI = GUICreate('Testing', 200, 100) $TAB = GUICtrlCreateTab(0, 0, 200, 100) $TABITEM1 = GUICtrlCreateTabItem('TAB 1') $TABBUTTON[1] = GUICtrlCreateButton('BUTTON FOR TAB 1', 10, 30, 120, 30) $TABITEM2 = GUICtrlCreateTabItem('TAB 2') GUISetState() While 1 $MSG = GUIGetMsg() If $MSG = - 3 Then Exit If $MSG = $TABBUTTON[1] Then GUISwitch($TestGUI, $TABITEM1) $TABBUTTON[2] = GUICtrlCreateButton('BUTTON2 FOR TAB1', 75, 65, 120, 30) GUICtrlSetState($TABBUTTON[2], $GUI_SHOW) GUICtrlCreateTabItem("") EndIf WEnd Edit: Needs Beta... Edited March 8, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Wooltown Posted March 9, 2006 Author Share Posted March 9, 2006 Exact the function I needed, many thanks for the solution. Regards Sven 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