75 lines
3.2 KiB
Plaintext
75 lines
3.2 KiB
Plaintext
Program to test GUI using tcl/tk.
|
||
|
||
20040212 -- Added a call (in tcl) to "cobol_update", so we may
|
||
do something in tcl just after each reentry in the tcl's code, as
|
||
consequence of the cobol calling "testgui02". This may be useful,
|
||
for instance, to add passed Cobol values into a list.
|
||
Please, open the enclosed sample file "testgui03.tcl" in Visual Tcl
|
||
and edit the "cobol_update" proc. If no such proc is defined,
|
||
there is a replacement "do nothing" included.
|
||
So, if you want to do something in tcl, each time Cobol calls your
|
||
script (CALL "testgui02" USING...), you just define a "proc cobol_update"
|
||
with no arguments and do what you want. Please, notice each separate
|
||
script needs its own cobol_update procedure, as each call to "newGui"
|
||
will make it "do nothing" again.
|
||
|
||
The script testgui03.tcl was generated by a visual editor, Visual Tcl (or
|
||
simply vTcl). The C interface was modified again, so it will run without
|
||
need to edit the generated code, "out of the box".
|
||
So the idea is, edit your windows in vTcl, edit the "main" proc, and add
|
||
there your "set cobol_fields ..." variable, as before. And don't forget to
|
||
associate your variables to the widgets (entry boxes, checkbuttons, button,
|
||
and so on...). Then, bingo! Your cobol program will call a vTcl-generated
|
||
GUI like magic.
|
||
If you are running under X-Windows or any other graphic environment (Windows?!),
|
||
throw away your "screen section" and design the most beautiful interfaces you
|
||
can. This is limited only by your imagination. You will have the full power
|
||
of tcl and the tk toolkit in your hands. And if you rely on vTcl or any other
|
||
of the many GUI builders available for tcl/tk, you don't need to learn a lot
|
||
of tcl to get started.
|
||
|
||
Rildo Pragana
|
||
|
||
|
||
== Old Readme.txt ==
|
||
|
||
Program to test GUI using tcl/tk.
|
||
|
||
To compile test program run r.sh.
|
||
|
||
The shell script will run make and create a trace file '*trace.txt'.
|
||
|
||
To clean type make clean.
|
||
|
||
To run type(example):
|
||
testgui01
|
||
|
||
The other example, testgui04, is more elaborate (yet simpler!):
|
||
|
||
When you run it, you will enter a command loop, written in cobol,
|
||
that will call the tcl interpreter to evaluate each text line entered.
|
||
So, please, enter only valid tcl/tk commands. The tcl interpreter is
|
||
extended with a new command "call_cobol" to send any string (just 1 argument)
|
||
to a predefined cobol procedure, contained in testgui06.cob.
|
||
To leave the program, just enter <Return>, a blank line.
|
||
|
||
Here are some example commands you may enter:
|
||
(session captured with "script")
|
||
|
||
root@percproj ~/work/SForge/development/test.code/tgui01# ./testgui04
|
||
tcl> set name "Rildo Pragana"
|
||
Rildo Pragana
|
||
tcl> set x 1234
|
||
1234
|
||
tcl> exp $x*2
|
||
invalid command name "exp"
|
||
tcl> expr $x*2
|
||
2468
|
||
tcl> call_cobol "My name is $name, . Nice to meet you!"
|
||
COBOL: Tcl program sent us: [My name is Rildo Pragana. Nice to meet you! ]
|
||
|
||
tcl>
|
||
End TCL interpreter
|
||
root@percproj ~/work/SForge/development/test.code/tgui01#
|
||
|