File: cedit1.tcl

package info (click to toggle)
blt 3.0~1%2B08570046%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 45,556 kB
  • sloc: ansic: 278,852; tcl: 96,434; sh: 3,410; makefile: 2,026; cpp: 374
file content (44 lines) | stat: -rw-r--r-- 1,281 bytes parent folder | download
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

package require BLT

proc GotText { text } {
    puts stderr "text is $text"
}

set text \
"Four score and seven years ago our fathers brought forth on this
continent, a new nation, conceived in Liberty, and dedicated to the
proposition that all men are created equal.

Now we are engaged in a great civil war, testing whether that nation, or
any nation so conceived and so dedicated, can long endure. We are met on a
great battle-field of that war. We have come to dedicate a portion of that
field, as a final resting place for those who here gave their lives that
that nation might live. It is altogether fitting and proper that we should
do this. 
"
blt::comboeditor .e -exportselection yes \
    -xscrollbar .e.xs \
    -yscrollbar .e.ys \
    -height 1i \
    -insertofftime 0 \
    -width 2i \
    -justify left 

blt::tk::scrollbar .e.xs
blt::tk::scrollbar .e.ys
text .t
pack .t
set n [string length "Four score and seven years ago our fathers brought forth on this"]
.e select range 1 96
.e icursor [expr $n + 1]
#.e insert 4 "\nextra\ncharacters\n"
focus .e
after 500 {
    set rootx [expr [winfo rootx .] + 100]
    set rooty [expr [winfo rooty .] + 100]
    .e post -popup [list $rootx $rooty] -text $text -command GotText
    update
    grab .e 
    focus -force .e
}