LithiumLi Posted April 19, 2009 Posted April 19, 2009 (edited) I am making my own notepad with tabs but am having trouble... add text into a tab create a new tab and inside the new tab there is the same text from first tab although it's a different array storing the data? It is hard to explain the problem to get the problem I am having type in the edit and make new tabs and keep clicking random tabs. expandcollapse popup#include <GUITab.au3> #include <Constants.au3> #include <GUIToolbar.au3> #include <EditConstants.au3> #include <TabConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Width = 500 $Height = 500 $ScriptName = "Notepad" $DefaultTabName = "Untitled" Global $Tabs[99] , $Text[99] $Notepad = GUICreate($ScriptName, $Width, $Height , Default , Default , Default, $WS_EX_ACCEPTFILES) $FileMenu = GUICtrlCreateMenu("File") $FileNew = GUICtrlCreateMenuItem("New" , $FileMenu) $TabMenu = GUICtrlCreateTab(0, 0, $Width , 25) $Tabs[0] = GUICtrlCreateTabItem($DefaultTabName) $Text[0] = GUICtrlCreateEdit("", 0, 25, $Width , $Height -45) GUISetState(@SW_SHOW) $TabText = 0 While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE MsgBox(0 , "" , GUICtrlRead($Text[_GUICtrlTab_GetCurSel($TabMenu)])) Exit Case $FileNew If $TabText = 9 Then MsgBox(0 , $ScriptName , "Sorry you can't have any more tabs.") Else $TabText+= 1 $Temp = GUICtrlCreateTabItem($DefaultTabName) $Text[$TabText] = GUICtrlCreateEdit("", 0, 25, $Width , $Height -45) GUICtrlSetState($Temp, $GUI_SHOW) EndIf EndSwitch WEnd ;_GUICtrlEdit_GetSel() Edited April 19, 2009 by LithiumLi
Authenticity Posted April 19, 2009 Posted April 19, 2009 Replace the else case to: $tmp = GUICtrlCreateTabItem($DefaultTabName) $Text[$TabText] = GUICtrlCreateEdit("", 0, 25, $Width , $Height -45) GUICtrlSetState($tmp, $GUI_SHOW)
LithiumLi Posted April 19, 2009 Author Posted April 19, 2009 Replace the else case to: $tmp = GUICtrlCreateTabItem($DefaultTabName) $Text[$TabText] = GUICtrlCreateEdit("", 0, 25, $Width , $Height -45) GUICtrlSetState($tmp, $GUI_SHOW) Thanks it seems to be working.
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