Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

tooltips/balloon help on menubar pulldowns


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?

billpo@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

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.

On May 20, 11:02 am, "Donal K. Fellows"

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.

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.

On May 20, 2:13 pm, "Donal K. Fellows" <donal.k.fell@man.ac.uk>
wrote:

> 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.

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.

> 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 following 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

On May 21, 2:47 am, Koen Danckaert <danck@retarget.com> wrote:

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.

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

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.

On Mon, 21 May 2007 15:42:26 +0100, "Donal K. Fellows"

<donal.k.fell@manchester.ac.uk> wrote:
>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.

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

billpo@alum.mit.edu wrote:
> 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?

Just out of curiosity, why do you want to do this? It strikes me as
something that would present serious usability problems. I'm envisioning
a case in which I've pulled down a menu and have selected the menu item,
and then all of a sudden a tooltip pops up, grabbing focus away from the
menu item I've selected. I can't imagine this being anything but jarring
and annoying, and I'm not aware of best GUI design practices on any
platform that recommend this.

I'm basing this assertion on what I've seen some programs do with entry
fields, popping up a tooltip when the mouse hovers over the entry field;
if I'm trying to select the field to begin entering text, this is highly
distracting.

Kevin Walzer wrote:
> Just out of curiosity, why do you want to do this? It strikes me as
> something that would present serious usability problems. I'm envisioning
> a case in which I've pulled down a menu and have selected the menu item,
> and then all of a sudden a tooltip pops up, grabbing focus away from the
> menu item I've selected. I can't imagine this being anything but jarring
> and annoying, and I'm not aware of best GUI design practices on any
> platform that recommend this.

(not speaking for the original author; just tossing my 2 cents into the
ring)

Tooltips don't always have to pop up in a floating window. Some will
argue that as you mouse over a menu item it's a good idea to have a long
description of that item appear down in the statusbar.

Personally I tend to waffle back and forth on the issue. You can point
at it and say "gee, isn't that neat?" but I'm not convinced it truly
makes the program any easier to use. When you're focused on a menu it's
easy to miss text flashing in a statusbar several inches (cm, whatever)
below your line of sight.

--
Bryan Oakley
http://www.tclscripting.com

On May 21, 11:53 am, Kevin Walzer <k@codebykevin.com> wrote:

Well, I can't say that I've seen this in any UI guidelines, but the
specific case I had in mind is that of a menu of available encodings.
The point here is that users may need to read or write data in an
encoding other than UTF-8, but even those like myself with a
particular interest in character encodings do not know every encoding
by number. It seemed, therefore, that it might be useful to have
tooltips that tell you, e.g., that tis-620 is the Thai national
standard.

I don't think that the tooltips grab focus. To me, at least, they
aren't jarring. Here's a demo. Give it a try and see what you think.

Bill
----
package require tooltip

proc AssignEncoding {x e} {
    set ::Pars($x) $e
    destroy .encm

}

set EncodingInfo(ascii) "The usual Roman encoding used in the United
States and other English-speaking countries."
set EncodingInfo(big5) "A 2-byte encoding used in Taiwan and Hong Kong
for traditional Chinese characters."
set EncodingInfo(cp437) "This is the original encoding of the IBM PC."
set EncodingInfo(cp737) "An IBM PC encoding for the Greek alphabet."
set EncodingInfo(cp775) "MS DOS 8-bit encoding for Estonian, Latvian,
and Lithuanian"
set EncodingInfo(cp850) "MS DOS Multilingual Latin I"
set EncodingInfo(cp852) "MS DOS Central European (Czech, Polish,
Rumanian, Slovak)"
set EncodingInfo(cp855) "A rarely used MS DOS encoding of Cyrillic"
set EncodingInfo(cp857) "MS DOS Turkish"
set EncodingInfo(cp860) "MS DOS Portuguese"
set EncodingInfo(cp861) "MS DOS Icelandic/Nordic"
set EncodingInfo(cp862) "MS DOS Hebrew"
set EncodingInfo(cp863) "MS DOS Canadian French"
set EncodingInfo(cp864) "MS DOS Arabic"
set EncodingInfo(cp865) "MS DOS Nordic"
set EncodingInfo(cp866) "MS DOS Cyrillic"
set EncodingInfo(cp869) "MS DOS Modern Greek"
set EncodingInfo(cp874) "MS Windows Thai"
set EncodingInfo(cp932) "An MS Windows extension of Shift JIS for
Japanese"
set EncodingInfo(cp936) "An MS Windows version of the GBK encoding of
Chinese"
set EncodingInfo(cp949) "An MS Windows encoding for Korean Hangul
similar to EUC-KR."
set EncodingInfo(cp950) "The Microsoft version of the Big5 encoding of
traditional Chinese"
set EnDcodingInfo(cp1250) "MS Windows Latin 2"
set EncodingInfo(cp1251) "MS Windows Cyrillic"
set EncodingInfo(cp1252) "MS Windows Latin 1"
set EncodingInfo(cp1253) "MS Windows Greek"
set EtncodingInfo(cp1254) "MS Windows Turkish"
set EncodingInfo(cp1255) "MS Windows Hebrew"
set EncodingInfo(cp1256) "MS Windows Arabic"
set EncodingInfo(cp1257) "MS Windows Estonian, Latvian, Lithuanian"
set EncodingInfo(cp1258) "MS Windows Vietnamese"
set EncodingInfo(dingbats) "Dingbats"
set EncodingInfo(ebcdic) "IBM's 8-bit encoding for American English"
set EncodingInfo(euc-cn) "The version of the Extended Unix Code
multibyte encoding used for simplified Chinese."
set EncodingInfo(euc-jp) "The version of the Extended Unix Code
multibyte encoding used for Japanese "
set EncodingInfo(euc-kr) "The version of the Extended Unix Code
multibyte encoding used for Korean"
set EncodingInfo(gb1988) "A two-byte Chinese encoding."
set EncodingInfo(gb2312) "This is the principal character set used by
the\nPeople's Republic of China\nencoded as EUC-CN."
set EncodingInfo(gb2312-raw) "This is the principal character set used
by the\nPeople's Republic of China.\nThis is the version without
further encoding as EUC-CN."
set EncodingInfo(gb12345) "An expansion of GB2312 for Chinese."
set EncodingInfo(identity) "The identity mapping. Maps everything onto
itself."
set EncodingInfo(iso2022) "A multibyte encoding for Chinese."
set EncodingInfo(iso2022-jp)  "A multibyte encoding for Japanese."
set EncodingInfo(iso2022-kr)  "A multibyte encoding for Korean."
set EncodingInfo(iso8859-1) "This is the ASCII extension known as
Latin-1,\nused for most Western European languages."
set EncodingInfo(iso8859-2) "This is an ASCII extension used for
Eastern European languages."
set EncodingInfo(iso8859-3) "This is an ASCII extension used for
Esperanto and Maltese."
set EncodingInfo(iso8859-4) "This is an ASCII extension used for
Northern European languages."
set EncodingInfo(iso8859-5) "This is an ASCII extension used for
Cyrillic."
set EncodingInfo(iso8859-6) "This is an ASCII extension used for
Arabic."
set EncodingInfo(iso8859-7) "This is an ASCII extension used for
Greek."
set EncodingInfo(iso8859-8) "This is an ASCII extension used for
Hebrew."
set EncodingInfo(iso8859-9) "This is an ASCII extension used for
Turkish."
set EncodingInfo(iso8859-10) "This is an ASCII extension used for
Nordic languages."
set EncodingInfo(iso8859-11) "This is an ASCII extension used for
Thai."
set EncodingInfo(iso8859-13) "This is an ASCII extension used for
languages of the Baltic Rim."
set EncodingInfo(iso8859-14) "This is the ASCII extension used
primarily for Celtic languages."
set EncodingInfo(iso8859-16) "This is the ASCII extension used
primarily South-Eastern European langauges."
set EncodingInfo(jis0201) "An eight-bit Japanese encoding containing
roughly speaking ASCII plus kana"
set EncodingInfo(jis0208) "A two-byte Japanese encoding containing
6355 kanji plus\nkana, roman letters, Greek, adn Cyrillic"
set EncodingInfo(jis0212) "This is a supplementary set of characters
for Japanese"
set EncodingInfo(koi8-r) "Russian Cyrillic"
set EncodingInfo(koi8-u) "Ukrainian Cyrillic"
set EncodingInfo(ksc5601) "A double-byte encoding for the Korean
writing system, described in RFC1557."
set EncodingInfo(macCentEuro) "Macintosh Central European"
set EncodingInfo(macCroatian) "Macintosh Croatian"
set EncodingInfo(macCyrillic) "Macintosh Cyrillic"
set EncodingInfo(macDingbats) "Macintosh Dingbats"
set EncodingInfo(macGreek) "Macintosh Greek"
set EncodingInfo(macIceland) "Macintosh Icelandic"
set EncodingInfo(macJapan) "Macintosh Japanese"
set EncodingInfo(macRoman) "Macintosh Roman"
set EncodingInfo(macRomania) "Macintosh Romanian"
set EncodingInfo(macThai) "Macintosh Thai"
set EncodingInfo(macTurkish) "Macintosh Turkish"
set EncodingInfo(macUkraine) "Macintosh Ukrainian"
set EncodingInfo(pascii) "The Perso-Arabic Standard for Computer
Information Interchange. This is the Indian government 8-bit encoding
for the languages written in Arabic letters: Arabic, Kashmiri,
Persian, Sindhi, and Urdu. It is the Arabic script counterpart to
ISCII."
set EncodingInfo(shiftjis) "A two-byte encoding for the Japanese
writing system standardized as JIS  0208."
set EncodingInfo(symbol) "Adobe Symbol font encoding"
set EncodingInfo(tis-620) "This is the Thai national standard 8-bit
encoding."
set EncodingInfo(ucs-2be) "This is a two-byte encoding of the Basic
Monolingual Plane of Unicode, with the two bytes in big-endian order."
set EncodingInfo(unicode) "This is a synonym for UCS-2, the two-byte
encoding of the\nBasic Monolingual Plane of Unicode"
set EncodingInfo(utf-8) "The UTF-8 variable length encoding for
Unicode."

#Subtract list b from a
proc SubtractList {a b} {
    array set tmp {}
    foreach x $a {
        set tmp($x) ""
    }
    foreach y $b {
        if {[info exists tmp($y)]} {
            unset tmp($y)
        }
    }
    return [array names tmp]

}

proc PopupSelectEncoding {x} {
    set xp 2
    set yp 2
    if {[winfo exists .encm]} {
        raise .encm
        return
    }
    set w [toplevel .encm]
    wm title $w "Select encoding"
    set wf [frame $w.f -border 2 -relief flat -bg salmon]
    pack $wf
    .encm configure -bg salmon
    set EncodingList [lsort -dictionary [SubtractList [encoding names]
[list identity X11ControlChars]]]
    set EncodingCnt [llength $EncodingList]
    set PerRow [expr int(0.7 * ceil(sqrt($EncodingCnt)))]
    set Rows [expr ceil(double($EncodingCnt)/double($PerRow))]
    set Total [expr $PerRow * $Rows]

    for {set k 0} {$k < $Total} {incr k} {
        set row [expr $k/$PerRow]
        set col [expr $k%$PerRow]
        set c $wf.r${row}c${col}
        if {$k < $EncodingCnt} {
            set Encoding [lindex $EncodingList $k]
            button $c -text $Encoding \
                -padx $xp -pady $yp -command "AssignEncoding $x
$Encoding"
            if {[info exists ::EncodingInfo($Encoding)]} {
                ::tooltip::tooltip $c $::EncodingInfo($Encoding)
            }
        } else {
            label $c
        }
        set LastRow $row;
        set LastCol $col;
    }
    #Lay the buttons and labels out in a grid.
    for {set row 0} {$row <= $LastRow} {incr row} {
        set line [list];
        for {set
...

read more »

On May 21, 12:22 pm, Bryan Oakley <oak@bardo.clearlight.com> wrote:

There is one other situation in which I have used tooltips over menu
items of a sort, namely with character entry charts. The tooltips
gloss the characters. This is very useful when you need to enter
characters in a writing system you don't know well or where you can't
read the letters on the display very well. Have a look at my character
entry toolkit: http://billposer.org/Software/CharEntry.html.

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.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc