[vwnc] Tooltip support

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Tooltip support

Annick
Is there any documentation or example for the new tooltip support in  
7.6 ?

Annick fron

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Tooltip support

Travis Griggs-3
On Jun 18, 2008, at 5:51 AM, Annick Fron wrote:

> Is there any documentation or example for the new tooltip support in
> 7.6 ?

Not much, here's the little that the Release Notes has:

"While the new version is backwards compatible, it does so through a
more powerful API than provided before. In addition to the original
helpText: API, one may also set the tooltip: of a widget. This maybe any
object which responds to asTooltipGraphicFor:. In this way, any
VisualComponent can be used for a tooltip. Furthermore, it may be a  
block,
allowing the tooltip to be dynamic and computed at open time. "

In some ways, there's not much more than that actually. What would you  
like to do with it?

--
Travis Griggs
Objologist
"You A students, you'll be back soon teaching here with me. You B  
students, you'll actually go on to be real engineers. You C students,  
you'll go into management and tell the A and B students what to do." -  
My Fluid Dynamics Professor whom I have yet to disprove


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Tooltip support

Travis Griggs-3
On Jun 18, 2008, at 7:02 AM, Annick Fron wrote:

> Hi,
>
> I would just like to associate a tooltip to a visual part and being  
> able to change it dynamically.
>
> Can I use something like :
>
> postBuildWith: builder
> (builder componentAt: #myComponent) tooltip: [^self computeString]


I think you need to put a widget in there, or use the widgetAt: API.  
You don't need the ^ either. So either

(builder componentAt: #myComponent) widget tooltip: [self  
computeString].

or

(self widgetAt: #myComponent) tooltip: [self computeString]

A couple of extra permutations that might be of interest...

You do not have to put a string alone in there. You can return any  
sort of VisualComponent. You can wrap it with a block computation or  
put that in computeString.

(self widgetAt: #myComponent) tooltip: [self computeTooltip]

computeTooltip
        ^ToolbarIconLibrary visualFor: #copy

Or you can do it directly if you didn't want it dynamic:

(self widgetAt: #myComponent) tooltip: (ToolbarIconLibrary visualFor:  
#copy)

When/if you decide to use a block, the block can be 0 or 1 arg (we  
call this block a "culled" block). If it has an arg, it is the view  
object of the  originating tooltip. So you can do this:

(self widgetAt: #myComponent) tooltip: [:view | view topComponent label]

This last example will use whatever is the label of your window as the  
tooltip (not very useful itself, but illustrative of the fact that it  
is dynamic (computed) and has access to the view object which is often  
a good starting point to derive dynamic tooltips.

Happy tipping. :)

--
Travis Griggs
Objologist
What's next, Intel Processors branded with "Apple Outside" stickers?


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc