For Programmers: Free Programming Magazines  


Home > Archive > Tcl > November 2006 > tcl/tc menu tearOffCommand option









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author tcl/tc menu tearOffCommand option
rossalexander@hotmail.co.uk

2006-11-29, 7:08 pm

Hi guys,

I have an application that uses multiple nested menus. I have recently
implemented the tearoff option and I'm trying to add a close button
using the tearOffCommand, i.e. when the menu is torn the script adds
the close option to the bottom. From reading the documentation I got
the impression this wouldn't affect the origenal menu, but it is. Is
this what should happen?

Below is the code I have written.

proc tearoffCallback { host oldMenu newMenu } {

# Add CLOSE option
$newMenu add separator
$newMenu add command -font 6x12 -label "CLOSE" -command "destroy
$newMenu"

}

Thanks,
Ross.

Dave

2006-11-29, 10:03 pm

On 29 Nov 2006 10:05:47 -0800, rossalexander@hotmail.co.uk wrote:

>Hi guys,
>
>I have an application that uses multiple nested menus. I have recently
>implemented the tearoff option and I'm trying to add a close button
>using the tearOffCommand, i.e. when the menu is torn the script adds
>the close option to the bottom. From reading the documentation I got
>the impression this wouldn't affect the origenal menu, but it is. Is
>this what should happen?
>
>Below is the code I have written.
>
>proc tearoffCallback { host oldMenu newMenu } {
>
> # Add CLOSE option
> $newMenu add separator
> $newMenu add command -font 6x12 -label "CLOSE" -command "destroy
>$newMenu"
>
>}
>
>Thanks,
>Ross.



It won't work because the menus are generated in the same widget. Why aren't
the regular destroy a window options good enough for you? You could create a
new widget by adding a command to a proc that opens a new widget and displays
the menu, but that is a lot of work for very little benefit.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com