This is example.tcl in view mode; [Download] [Up]
# # This is an example initialization file for # a Tcl based application. # usage: msg <sender id> # # This is the procedure thats invoked by actions in the user # interface. # proc msg {sender} { # keep the id of the sender global lastmsg set lastmsg $sender # possibly issue beep global beeper if {$beeper} { beep } set tag [send "i@:" $sender selectedTag] case $tag in {1} { global dateTextId set date [exec date] send " @:*" $dateTextId setStringValue: $date } {3} { global beeper set beeper [send "i@:" $sender intValue] } {4} { global sidePanelId global TclObj global NXApp if {!$sidePanelId} { set sidePanelId [send "i@:*i" $NXApp "loadNibSection:owner:" \ "panel.nib" $TclObj] } send " @:@" $sidePanelId orderFront: $sender } default { echo echo "message tag" $tag "not recognized!" echo "object name:" [getObjectName [send "i@:" $sender selectedCell]] echo "object class:" [send "*@:" $sender name] } } # usage: forward <selector> # # This procedure is called when the "forward" message is sent to the # tcl object. <selector> is the selector that was forwarded. # proc forward {selector} { echo "forward:" [selGetName $selector] } # usage: pp <proc name> # # This procedure prints out a representation of <proc name>. # Use this to get a procedure into an edit window so you can # hack on it. # proc pp {name} { format "proc $name {%s} {%s}" [info args $name] [info body $name] } # usage: startup # # This procedure is invoked when the TclObj gets an 'appDidInit' # message. # proc startup {} { # Bring up a debugging window for tcl global TclObj send " @:@" $TclObj createTextView: $TclObj # Get the id of the textfield that the date goes into global NXApp global mainWindowId set mainWindowId [getNamedObject "MainWindow" $NXApp] global dateTextId set dateTextId [getNamedObject "dateText" $mainWindowId] # set to not beep on commands by default global beeper set beeper 0 # initialize the sidePanelId to indicate that no panel is up global sidePanelId set sidePanelId 0 }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.