home *** CD-ROM | disk | FTP | other *** search
-
- if {[string compare test [info procs test]] == 1} then \
- {source defs}
-
- # set VERBOSE 1
-
- # the list of all callback info contains the
- # event field, which contains a runtime value
- # of the event number. This is meaningless for
- # tests, so lose it (arg 2)
- proc lose_event l {
- return [lreplace $l 1 1]
- }
-
- xtAppInitialize -class Arrow
- . setValues -allowShellResize true
-
- xmRowColumn .row managed
-
- xmArrowButton .row.arrow managed \
- -width 10 -height 10
-
- xmCommand .row.command managed
-
- . realizeWidget
-
-
- #############################
- # setup for arrow callbacks #
- #############################
-
- proc arrowCB {call} {
- return "[lose_event $call]"
- }
-
- .row.arrow armCallback {arrowCB {%call_data}}
- .row.arrow activateCallback {arrowCB [list %call_data]}
- .row.arrow disarmCallback {arrowCB [list %call_data]}
-
- #################
- # Arrow callbacks
- #################
-
- test callbacks-1.1 {arrow arm} {
- .row.arrow callActionProc Arm() \
- -type ButtonPress \
- -x 5 -y 5
- } {{reason arm}}
-
- # activate assumes it comes from a ButtonPress.
- # coords within its boundaries mean ButtonRelease
- # occurs within the widget, so activate callback occurs.
- # outside this, no callback is invoked
-
- # this one is inside boundary
- test callbacks-1.2 {arrow activate } {
- .row.arrow callActionProc Activate() \
- -type ButtonPress \
- -x 5 -y 5
- } {{reason activate} {click_count 1}}
-
- test callbacks-1.3 {arrow disarm} {
- .row.arrow callActionProc Disarm()
- } {{reason disarm}}
-
- test callbacks-1.4 {arrow armAndActivate} {
- .row.arrow callActionProc ArmAndActivate()
- } {{reason arm}{reason activate} {click_count 1}{reason disarm}}
-
- test callbacks-1.5 {arrow removeCallback disarmCallback} {
- .row.arrow removeCallback disarmCallback {arrowCB [list %call_data]}
- .row.arrow callActionProc Disarm()
- } {}
-
- .row.arrow destroyWidget
-
-
- #############################
- # setup for command callbacks #
- #############################
-
- proc commandCB {call} {
- return "[lose_event $call]"
- }
-
- .row.command commandChangedCallback {commandCB {%call_data}}
- .row.command commandEnteredCallback {commandCB [list %call_data]}
- .row.command applyCallback {commandCB [list %call_data]}
- .row.command cancelCallback {commandCB [list %call_data]}
- .row.command noMatchCallback {commandCB [list %call_data]}
-
- #################
- # Command callbacks
- #################
-
- # test callbacks-2.1 {command arm} {
- # .row.command callActionProc Arm()
- # } {{reason arm}}
-
-
- # we don't want to go into interactivity:
- # . mainLoop
-