Welcome, guest | Sign In | My Account | Store | Cart

Text editor with copy,cut and paste functions.

Tcl, 48 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/wish
#
# text editor with copy,cut and paste functions.
# licence: G.P.L

frame .menubar -borderwidth 0
      pack .menubar -side top -fill x
      
      menubutton .menubar.file -text File \
           -underline 0 -menu .menubar.file.m
      menubutton .menubar.edit -text Edit \
            -underline 0 -menu .menubar.edit.m
      menubutton .menubar.help -text ~ \
           -menu .menubar.help.m
      
      menu .menubar.file.m -tearoff 0
      menu .menubar.edit.m -tearoff 0
      menu .menubar.help.m -tearoff 0
           pack .menubar.file .menubar.edit -side left
           pack .menubar.help -side right
           
      .menubar.file.m add command -label "Exit" \
           -underline 1 -command exit
      .menubar.edit.m add command -label "Cut" \
            -underline 2 \
            -command {event generate [focus] <<Cut>>}
      .menubar.edit.m add command -label "Copy" \
            -underline 0 \
            -command {event generate [focus] <<Copy>>}
      .menubar.edit.m add command -label "Paste" \
            -command {event generate [focus] <<Paste>>}
      .menubar.help.m add command -label "About"  \
            -command appHelpAbout 
# Text Box      
      text .t -wrap word
      pack .t -side top -fill both -expand y

proc appHelpAbout { } {
     global version licence

     tk_messageBox -message "\n\
     Text editor with copy,cut and paste functions.\n\
     Author: ME."
     
}
#-----------------------------
wm title .  "Editor v0.01"
wm minsize . 255 350