Leoj Posted June 23, 2008 Posted June 23, 2008 (edited) I have my script create a GUI with one tab. When you click a button I want new tabs to be added the tab element thing. I am able to do this but I'm pretty sure I'm not doing it right and that they don't have unique variable names that I can interact with. GUICreate($GUItitle,$GUIsize,$GUIsize) $tab=GUICtrlCreateTab (10,10, $GUIsize-20,$GUIsize-20) ... .. . If $msg = $loadButton Then ... .. . For $i = 1 to UBound($section) - 1 ;for every section... $tabName = IniRead($filename, $section[$i], "tabname", "null") ;get the listed tab name $fileNameLoc = IniRead($filename, $section[$i], "filenameloc", "null") ;get the listed file name If $fileNameLoc = "null" Then ;do nothing ElseIf $tabsOn = 1 Then $file = FileOpen($fileNameLoc, 0) ;open that file If $file = -1 Then MsgBox(0, "Error", "Unable to open file "&$fileNameLoc) Else $content = FileRead($file) ;read the files contents $tab = GUICtrlCreateTabitem($tabName) ;create the tab with appropriate tab name $edit = GUICtrlCreateEdit($content, $indentX, $indentY, $GUIsize-65, $GUIsize-90) ;create the edit area with appropriate contents EndIf FileClose($file) ... .. . EndIf EndIf I don't understand how to make this "$tab = GUICtrlCreateTabitem($tabName) ;create the tab with appropriate tab name" have a unique variable name that would let me delete the tab after it's been added in... Edited June 23, 2008 by Leoj
enaiman Posted June 23, 2008 Posted June 23, 2008 Declare an array $Tab_Item[10] (if you want 10 tabs ... or you can put a bigger number) Initialize a global variable: Dim $tab_no = 1 Change the following line: $tab = GUICtrlCreateTabitem($tabName) with $Tab_Item[$tab_no] = GUICtrlCreateTabitem($tabName) $tab_no +=1 This way each tab item will have its own variable so you can play with them later. Keep in mind that after you add the last tab item the $tab_no will be equal to number of tab items +1 (because the increment happen after adding the tab). Anyway, you have alot more to play with Good luck, SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Leoj Posted June 23, 2008 Author Posted June 23, 2008 (edited) thanks tons for your input enai -- I was able to finish my program because of it! Edited June 23, 2008 by Leoj
enaiman Posted June 23, 2008 Posted June 23, 2008 Welcome Glad it helped, SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
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