For Programmers: Free Programming Magazines  


Home > Archive > Tcl > May 2007 > tooltips/balloon help on menubar pulldowns









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 tooltips/balloon help on menubar pulldowns
billposer@alum.mit.edu

2007-05-20, 4:21 am

Following up on my previous query about the Tklib tooltips, I now
wonder whether any tooltip/balloonhelp package works on menu items
that descend from a menubar? There are at least half-a-dozen tooltip
packages. Most of them don't even purport to work on menus. Of those
that do, the Tklib tooltip package does work on menu items but not
when they descend from a menubar. Bwidgets has a tooltip package
called DynamicHelp that claims to work on menu items. It even has an
example of menu items descended from a menubar. That example does not
work when cut and pasted from the documentation into a file on my
Linux system. So, is there any known way to get tooltips on menu items
descended from a menubar?

Slaven Rezic

2007-05-20, 7:10 pm

billposer@alum.mit.edu writes:

> Following up on my previous query about the Tklib tooltips, I now
> wonder whether any tooltip/balloonhelp package works on menu items
> that descend from a menubar? There are at least half-a-dozen tooltip
> packages. Most of them don't even purport to work on menus. Of those
> that do, the Tklib tooltip package does work on menu items but not
> when they descend from a menubar. Bwidgets has a tooltip package
> called DynamicHelp that claims to work on menu items. It even has an
> example of menu items descended from a menubar. That example does not
> work when cut and pasted from the documentation into a file on my
> Linux system. So, is there any known way to get tooltips on menu items
> descended from a menubar?


Tk::Balloon for Perl/Tk works with menu items, at least on X11
systems. So theoretically it is possible, as the Perl/Tk
implementation does not use any Perl specialities for the balloons, as
far as I know.

Regards,
Slaven

--
Slaven Rezic - slaven <at> rezic <dot> de
babybike - routeplanner for cyclists in Berlin
handheld (e.g. Compaq iPAQ with Linux) version of bbbike
http://bbbike.sourceforge.net
Donal K. Fellows

2007-05-20, 7:10 pm

Slaven Rezic wrote:
> Tk::Balloon for Perl/Tk works with menu items, at least on X11
> systems. So theoretically it is possible, as the Perl/Tk
> implementation does not use any Perl specialities for the balloons, as
> far as I know.


It's quite possible to associate help with menus (I don't personally
like doing it with tooltips, but YMMV) through the <<MenuSelect>>
virtual event. However, when you do this it is easiest to avoid using
the %W substitution (except in the one case detailed below) and instead
put the name of the menu directly in the script (otherwise you get to
find out far too much about menu clones!). You will also want to use the
'index' subcommand. To see how these things might fit together, consider
the following little script (assuming the menu is called .m):

bind .m <<MenuSelect>> {puts "selected [%W index active] in .m"}

Note that I used %W here; this is required *here* or things "won't work"
(technically, you need the active item in the clone, not the active item
in the source menu). Also note that the active index can be 'none'. :-)

Once you've got the info out of the menu at the right time, getting
those tooltips up should be a breeze...

Donal.
billposer@alum.mit.edu

2007-05-20, 7:10 pm

On May 20, 11:02 am, "Donal K. Fellows"
<donal.k.fell...@manchester.ac.uk> wrote:
> Slaven Rezic wrote:
>
> It's quite possible to associate help with menus (I don't personally
> like doing it with tooltips, but YMMV) through the <<MenuSelect>>
> virtual event. However, when you do this it is easiest to avoid using
> the %W substitution (except in the one case detailed below) and instead
> put the name of the menu directly in the script (otherwise you get to
> find out far too much about menu clones!). You will also want to use the
> 'index' subcommand. To see how these things might fit together, consider
> the following little script (assuming the menu is called .m):
>
> bind .m <<MenuSelect>> {puts "selected [%W index active] in .m"}
>
> Note that I used %W here; this is required *here* or things "won't work"
> (technically, you need the active item in the clone, not the active item
> in the source menu). Also note that the active index can be 'none'. :-)
>
> Once you've got the info out of the menu at the right time, getting
> those tooltips up should be a breeze...
>
> Donal.


Thanks, although the provision of info as to how to do it suggests
that the existing packages that claim to do it really don't.

I agree that in general tooltips on menus are not the best idea, but I
have a particular case in which I think it would be useful.

Donal K. Fellows

2007-05-20, 7:10 pm

Bill Poser wrote:
> Thanks, although the provision of info as to how to do it suggests
> that the existing packages that claim to do it really don't.


I've no idea if they do or not. I just jumped in with the info in case
they didn't. Back when I was writing serious GUIs, there weren't that
any tooltip packages that looked halfway decent, let alone as good as
I wanted; hopefully things have improved since then, but I've not
checked for years. :-)

Donal.

billposer@alum.mit.edu

2007-05-20, 7:10 pm

On May 20, 2:13 pm, "Donal K. Fellows" <donal.k.fell...@man.ac.uk>
wrote:
> Bill Poser wrote:
>
> I've no idea if they do or not. I just jumped in with the info in case
> they didn't. Back when I was writing serious GUIs, there weren't that
> any tooltip packages that looked halfway decent, let alone as good as
> I wanted; hopefully things have improved since then, but I've not
> checked for years. :-)
>
> Donal.


There seem to be half-a-dozen or so tooltip packages, most of them
rather ad hoc. Most don't even attempt to handle menus, canvas or text
widgets. I have mostly my slightly modified version of the code in
Effective Tcl. That is pretty good, but doesn't try to handle menus.
Bwidgets has something called DynamicHelp, which purports to handle
menus, including menus descending from a menubar. The man page
actually includes code for the specific case in which I am interested,
but it doesn't work. The other package that I have used is Jeff Hobbs'
tooltip package from Tklib. This is one of the nicer packages, with
nice-looking balloons and a number of parameters controllable. It
works on menus that do not descend from a menubar but not on those
that do.

Overall, the situation isn't too bad, but it would be nice to have a
package that allowed a few more options to be set and allowed tooltips
to be found to anything one could reasonably image binding them to.

For my immmediate purpose, I think will just use a pseudo-menu, with a
bunch of regular buttons gridded onto a toplevel.

Koen Danckaert

2007-05-21, 8:09 am

> There seem to be half-a-dozen or so tooltip packages, most of them
> rather ad hoc. Most don't even attempt to handle menus, canvas or text
> widgets. I have mostly my slightly modified version of the code in
> Effective Tcl. That is pretty good, but doesn't try to handle menus.
> Bwidgets has something called DynamicHelp, which purports to handle
> menus, including menus descending from a menubar. The man page
> actually includes code for the specific case in which I am interested,
> but it doesn't work.


That manpage also says the following: "For menu, balloon type help is not available." Indeed, dynamic help for a menu is normally displayed in an application's statusbar, not as a balloon-type tooltip. The example you are referring too contains the follow
ing lines:

# create label for help, using variable varinfo
label .l -textvariable varinfo

The intent is that you pack this label into the statusbar of your application.

--Koen
billposer@alum.mit.edu

2007-05-21, 8:09 am

On May 21, 2:47 am, Koen Danckaert <danck...@retarget.com> wrote:
>
> That manpage also says the following: "For menu, balloon type help is not available." Indeed, dynamic help for a menu is normally displayed in an application's statusbar, not as a balloon-type tooltip. The example you are referring too contains the foll

owing lines:
>
> # create label for help, using variable varinfo
> label .l -textvariable varinfo
>
> The intent is that you pack this label into the statusbar of your application.
>
> --Koen


Unfortunately, the manual page for DynamicHelp is screwed up. The
additional information that you cite is provided only under the
"register" subcommand, which is deprecated, not under the current
"add" subcommand where it belongs.

In any case, DynamicHelp is yet another instance of a package that
does not provide tooltips for menus.

Helmut Giese

2007-05-21, 8:09 am

Hi Bill,
FYI the reason Jeff's tooltips don't appear to work (on Windows at
least) is that the package receives the wrong coordinates. In fact,
the tooltip appears: Just have a look at the top left corner of - no,
not your application, but your screen.
For the menu relative coordinates are reported while the package
expects absolute coords (which works with all other widgets).

AFAIK there is no easy way out - there just isn't an interface to
query a menu for its position - let alone its width, which would be
equally important in order to know just where to place the tooltip.

Best regards
Helmut Giese
Donal K. Fellows

2007-05-21, 7:10 pm

Helmut Giese wrote:
> AFAIK there is no easy way out - there just isn't an interface to
> query a menu for its position - let alone its width, which would be
> equally important in order to know just where to place the tooltip.


Yes there is ([winfo] works with menus) but you need to work with the
clone and not the master.

Donal.
Helmut Giese

2007-05-21, 7:10 pm

On Mon, 21 May 2007 15:42:26 +0100, "Donal K. Fellows"
<donal.k.fellows@manchester.ac.uk> wrote:

>Helmut Giese wrote:
>
>Yes there is ([winfo] works with menus) but you need to work with the
>clone and not the master.


Hi Donal.,
I always learn something new here, thanks.
The clones, I suppose, are these terribly looking
.#mnu.#mnu#file, .#mnu.#mnu#edit
thingies?
Best regards
Helmut Giese
Donal K. Fellows

2007-05-21, 10:09 pm

Helmut Giese wrote:
> The clones, I suppose, are these terribly looking
> .#mnu.#mnu#file, .#mnu.#mnu#edit
> thingies?


Yes. Normally you can safely ignore them. But when you're working with
<<MenuSelect>> you do need to know because you're working with parts
of the menu state that aren't shared between clones and their master.

Donal.

Ertap4

2007-05-22, 9:39 pm

Cute blonde with REALLY big titties!
http://trully-bigtits.info/play.asp?bigtits218571
Sponsored Links







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

Copyright 2008 codecomments.com