Re: [tkined] Menu Items.

Dan Razzell (razzell@cs.ubc.ca)
Thu, 19 Feb 1998 13:28:53 -0800

> How can I add an item on the right-mouse-button-menu? (Like a properties
> item that would launch different dialogs depending on an Attribute of
> the node).

The technique is a little bit dirty because it involves modifying the
tkined distribution, more so if you want to invoke commands in an
interpreter you have written, since you now have to maintain your
interpreter so that it provides a stable API to this modified version
of tkined.

The function to change is Tool__MakePopup in tkined/library/Tool.tcl.
You simply add lines of the form:

$popup add command -label "New Command" -command "$command $args"

If the command is to take place in your interpreter, you have the problem
of finding the interpreter somehow. One possibility is:

foreach menu [$editor retrieve MENU] {
if {[$menu name] == "mymenu" {
set interp [$menu interpreter]
set command [list $interp mycommand myarg ...]
break
}
}

.^.^. Dan Razzell <razzell@cs.ubc.ca>
. o o . Laboratory for Computational Intelligence
. >v< . University of British Columbia
_____mm.mm_____ http://www.cs.ubc.ca/nest/lci

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.