Jump to content

Edit Control Problem


Recommended Posts

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.

#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 by LithiumLi
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...