Adding Commands

Now, the sub-menu file gets its commands:

(file-menu 'add 'command 
	#:label 'open 
	#:command (lambda () (print "opening")))
(file-menu 'add 'command 
	#:label 'save 
	#:command (lambda () (print "saving")))

There should appear a separator before the exit command:

(file-menu 'add 'separator)

Now the exit-command:

(file-menu 'add 'command 
	#:label 'exit 
	#:command (lambda () (end-tk)))

The sub-menu edit also:

(edit-menu 'add 'command 
	#:label 'cut 
	#:command (lambda () (print "cutting")))
(edit-menu 'add 'command 
	#:label 'copy 
	#:command (lambda () (print "copying")))
(edit-menu 'add 'command 
	#:label 'paste 
	#:command (lambda () (print "pasting")))

If you tear off the edit command, it should look as follows:

edit3entries

See also menu.


© Author | Home | Sitemap