AlmarM Posted September 19, 2008 Share Posted September 19, 2008 (edited) Hello,I was writing a script and I wasted my time by writing GUICtrlCreateTab() and GUICtrlCreateTabItem() all the time.So I wrote _Create_Tab()I know its simple, but I tought I shared it with you guys ; #FUNCTION# =========================================================================== ; Name...........: _Create_Tab() ; Description ...: Uses the GUICtrlCreateTab() and GUICtrlCreateTabItem() in one ; Syntax.........: _CreateTab($left, $top, $width, height, [$style, [$exstyle]]) ; Parameters ....: - ; Return values .: - ; Author ........: Almar Mulder (AlmarM) ; Modified.......: - ; Remarks .......: - ; Related .......: GUICtrlCreateTab(), GUICtrlCreateTabItem() ; Link ..........: http://www.autoitscript.com/forum/index.php?showtopic=80919 ; Example .......: Yes (_Create_Tab(10, 10, 500, 500, "Example Tab", $TCS_FIXEDWIDTH, $TCS_EX_FLATSEPARATORS)) ; #FUNCTION# =========================================================================== Func _Create_Tab($left, $top, $width, $height, $name, $style = "", $exstyle = "") GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) GUICtrlCreateTabItem($name) EndFuncIts GUICtrlCreateTab() and GUICtrlCreateTabItem() in ONE!AlmarMEDIT: Added the cool #FUNCTION# thing >_< Edited September 19, 2008 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
martin Posted September 19, 2008 Share Posted September 19, 2008 Hello, I was writing a script and I wasted my time by writing GUICtrlCreateTab() and GUICtrlCreateTabItem() all the time. So I wrote _Create_Tab() I know its simple, but I tought I shared it with you guys ; #FUNCTION# =========================================================================== ; Name...........: _Create_Tab() ; Description ...: Uses the GUICtrlCreateTab() and GUICtrlCreateTabItem() in one ; Syntax.........: _CreateTab($left, $top, $width, height, [$style, [$exstyle]]) ; Parameters ....: - ; Return values .: - ; Author ........: Almar Mulder (AlmarM) ; Modified.......: - ; Remarks .......: - ; Related .......: GUICtrlCreateTab(), GUICtrlCreateTabItem() ; Link ..........: http://www.autoitscript.com/forum/index.php?showtopic=80919 ; Example .......: Yes (_Create_Tab(10, 10, 500, 500, "Example Tab", $TCS_FIXEDWIDTH, $TCS_EX_FLATSEPARATORS)) ; #FUNCTION# =========================================================================== Func _Create_Tab($left, $top, $width, $height, $name, $style = "", $exstyle = "") GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) GUICtrlCreateTabItem($name) EndFunc Its GUICtrlCreateTab() and GUICtrlCreateTabItem() in ONE! AlmarM EDIT: Added the cool #FUNCTION# thing >_<It is maybe a little too simple since if you want more than one tab it hasn't really helped much. If you made it a bit more versatile so it could create all the tabs you needed then it would be more useful. _Create_tab(80,100,250,200,"onions|tomatoes|figs") Func _Create_Tab($left, $top, $width, $height, $tabnames, $style = "", $exstyle = "") Local $TabItems = StringSplit($tabnames, "|") GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) For $n = 1 To $TabItems[0] GUICtrlCreateTabItem($TabItems[$n]) Next EndFunc ;==>_Create_Tab 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...
AlmarM Posted September 19, 2008 Author Share Posted September 19, 2008 It is maybe a little too simple since if you want more than one tab it hasn't really helped much. If you made it a bit more versatile so it could create all the tabs you needed then it would be more useful. _Create_tab(80,100,250,200,"onions|tomatoes|figs") Func _Create_Tab($left, $top, $width, $height, $tabnames, $style = "", $exstyle = "") Local $TabItems = StringSplit($tabnames, "|") GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) For $n = 1 To $TabItems[0] GUICtrlCreateTabItem($TabItems[$n]) Next EndFunc ;==>_Create_Tab Heya! Nice one, didnt tought about that one! AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Valuater Posted September 20, 2008 Share Posted September 20, 2008 Also that function should return $TabItems[] array 8) Link to comment Share on other sites More sharing options...
martin Posted September 20, 2008 Share Posted September 20, 2008 Also that function should return $TabItems[] array 8) Um, that's a good point. Maybe something like this $tab1 = _Create_tab(80,100,250,200,"onions|tomatoes|figs") ;Creates a tab with tabitems as the '|' separated list in $tabnames ;returns an array where ; element [0] = tab ID ; element [1] = number of tabitems ; element [2] = tabitem1 ; element [3] = tabitem2 ID etc Func _Create_Tab($left, $top, $width, $height, $tabnames, $style = "", $exstyle = "") Local $TabItems = StringSplit($tabnames, "|") Local $ttab[ubound($TabItems) + 1] $ttab[0] = GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) $ttab[1] = $TabItems[0] For $n = 1 To $TabItems[0] $ttab[$n + 1] = GUICtrlCreateTabItem($TabItems[$n]) Next Return $ttab EndFunc ;==>_Create_Tab 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...
AlmarM Posted September 21, 2008 Author Share Posted September 21, 2008 (edited) Hey, I've tried the same thing, but it isnt working all Its just for fun ^^ expandcollapse popupFunc _Create_Tabs($left, $top, $width, $height, $tabs, $style = "", $exstyle = "") Local $TabItems = StringSplit($tabs, "|") Local $Tab[UBound($TabItems) +1] $Tab[0] = GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) $Tab[1] = $TabItems[0] For $x = 1 To $TabItems[0] $Tab[$x + 1] = GUICtrlCreateTabItem([$x]) Next Return $Tab EndFunc ;==> _Create_Tab() Func _Create_Listviews($text, $items, $listviewID, $left, $top, $width, $height, $style = "", $exstyle = "") Local $ListItems = StringSplit($items, "|") Local $List[UBound($ListItems) +1] $List[0] = GUICtrlCreateListView($text, $left, $top, $width, $height, $style, $exstyle) $List[1] = $ListItems[0] For $x = 1 To $ListItems[0] $List[$x + 1] = GUICtrlCreateListViewItem([$x], $listviewID) Next Return $List EndFunc ;==> _Create_Listviews() Func _Create_Menus($submenutext, $itemtext, $menuid, $menuentry, $radio = 0) Local $MenuItems = StringSplit($itemtext, "|") Local $Menu[UBound($MenuItems) +1] $Menu[0] = GUICtrlCreateMenu($submenutext, $menuid, $menuentry) $Menu[1] = $MenuItems[0] For $x = 1 To $MenuItems[0] $Menu[$x + 1] = GUICtrlCreateMenuItem($itemtext, $menuid, $menuentry, $radio) Next Return $Menu EndFunc ;==> _Create_Menus() Func _Create_TreeViews($text, $treeviewID, $left, $top, $width, $height, $style = "", $exstyle = "") Local $TreeItems = StringSplit($text, "|") Local $Tree[UBound($TreeItems) +1] $Tree[0] = GUICtrlCreateTreeView($left, $top, $width, $height, $style, $exstyle) $Tree[1] = $TreeItems[0] For $x = 1 To $TreeItems[0] $Tree[$x + 1] = GUICtrlCreateTreeViewItem($text, $treeviewID) Next Return $Tree EndFunc ;==> _Create_TreeViews() AlmarM Edited September 21, 2008 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
AlmarM Posted September 22, 2008 Author Share Posted September 22, 2008 Hmm, I was thinking. If you use this Func _Create_Tab($left, $top, $width, $height, $tabnames, $style = "", $exstyle = "") Local $TabItems = StringSplit($tabnames, "|") Local $ttab[ubound($TabItems) + 1] $ttab[0] = GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) $ttab[1] = $TabItems[0] For $n = 1 To $TabItems[0] $ttab[$n + 1] = GUICtrlCreateTabItem($TabItems[$n]) Next Return $ttab EndFunc ;==>_Create_Tab Can you still made a button on for example tab 2 if there are like 5 tabs. AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
martin Posted September 22, 2008 Share Posted September 22, 2008 Hmm, I was thinking. If you use this Func _Create_Tab($left, $top, $width, $height, $tabnames, $style = "", $exstyle = "") Local $TabItems = StringSplit($tabnames, "|") Local $ttab[ubound($TabItems) + 1] $ttab[0] = GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) $ttab[1] = $TabItems[0] For $n = 1 To $TabItems[0] $ttab[$n + 1] = GUICtrlCreateTabItem($TabItems[$n]) Next Return $ttab EndFunc ;==>_Create_Tab Can you still made a button on for example tab 2 if there are like 5 tabs. AlmarM Er, no. At least I don't see how at the moment. :/ I also left out GUICtrlCreateTabItem("") after the tabs had been created. Perhaps the function should be allowed to slip slowly and quietly away. 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...
MadBoy Posted September 22, 2008 Share Posted September 22, 2008 Er, no. At least I don't see how at the moment. :/ I also left out GUICtrlCreateTabItem("") after the tabs had been created. Perhaps the function should be allowed to slip slowly and quietly away. You could reuse the $TabItems[] array with GUICtrlSetState() switch which should allow you to add buttons and other things at whichever tab you want. GuiCtrlSetState($tabitems[..], ...) Think this would work.. My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
AlmarM Posted September 22, 2008 Author Share Posted September 22, 2008 But the _Create_Tabs() func will create as many tabs as you want. But you could only make buttons or inputs or what ever on the last tab I think. You can't create stuff on for example the 2nd one. I think mine Func _Create_Tab($left, $top, $width, $height, $name, $style = "", $exstyle = "") GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) GUICtrlCreateTabItem($name) EndFunc Is just more usefull. Just my toughts... AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted September 22, 2008 Share Posted September 22, 2008 You could create all tabitems and save their ControlID in an array on Return and the use GuiSwitch() so you can create controls on them .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 22, 2008 Moderators Share Posted September 22, 2008 But the _Create_Tabs() func will create as many tabs as you want. But you could only make buttons or inputs or what ever on the last tab I think. You can't create stuff on for example the 2nd one. I think mine Func _Create_Tab($left, $top, $width, $height, $name, $style = "", $exstyle = "") GUICtrlCreateTab($left, $top, $width, $height, $style, $exstyle) GUICtrlCreateTabItem($name) EndFunc Is just more usefull. Just my toughts... AlmarMI'm lost on how this is useful at all to be honest. I can't remember when I ever created just 1 tab item for a tab. You don't return the control id for the tab or the item to be interacted with later on. In it's current setup, it's a useless function. 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...
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