How to update tooltip created by FireFly

Started by Jean-pierre Leroy, March 31, 2014, 08:58:21 AM

Previous topic - Next topic

Jean-pierre Leroy

Dear FF Users,

Since version 3.60 it is possible to create tooltip at design time.

Quote
- 0000575: [New Feature Request] Allow specifying Tooltip text for controls at design time (new 'ToolTip' and 'ToolTipBalloon' control properties) (Paul Squires) - closed.

I would like to update the tooltip later on with Tooltip_SetText wrapper function from Jose Roca. I have only one issue, I don't how to retrieve the original handle to the tooltip control in order to update it.

Any ideas ?

Thanks,
Jean-Pierre

Paul Squires

#1
Hi Jean-Pierre,

I don't think it is possible given the current FireFly code generation.


    ' If this control has a ToolTip specified then set it now
    FLY_String = "This is a tooltip"
    If Len(Trim$(FLY_String)) then
       pWindow.AddToolTip hWndControl, FLY_String, %FALSE
    End If   


As you can see, the hWnd for the created Tooltip is not being saved anywhere (ie. the return value from pWindow.AddToolTip would be the handle).

Given that limitation, I have not been able to find an easy way to get the ToolTip handle from its owner control:
http://stackoverflow.com/questions/1333770/how-to-get-tooltip-text-for-a-given-hwnd


Paul Squires
PlanetSquires Software

David Kenny

Jean-Pierre,

You can add it to the codegen file and then compile it with PBEdit or JellyFish Pro.
I have included a demo project to show you how.

Basically, create a global to hold the ToolTip handle.  Add a line to the Form.inc for the form the control resides in (CODEGEN_TOOLTIPTEST_FORM1_FORM.inc in the demo).  I added line 144 manually. Note:  If you recompile, that file will be overwritten.  You will have to make the change again.

You can leave the code you create (the global definition, the code to change the TooltipText) in place as you develop without any problem as the SetToolTipText method exits out gracefully if the global is 0. The tooltip won't change when running your intermediate builds.  When you are ready to create one to "publish", add the one line (for each tooltip you want to be able to change that is) to the codegen file and compile it with PBEdit or JFP.

Kludge for sure, but it will do what you need.

David

José Roca

> I would like to update the tooltip later on with Tooltip_SetText wrapper function from Jose Roca.

For tooltips created with the AddToolltip method of the CWindow class, you need to use the SetTooltiptext of CWindow. The class includes 3 methods, AddTooltip, DeleteTooltip and SetTooltiptext that are incompatible with the wrapper functions Tooltip_Add, Tooltip-Delete and Tooltip_SetText, because the methods use the handle of the control that contains the tooltip tool, whereas the wrappers use the handle of the parent window to allow the use of the TTF_IDISHWND flag. All the other wrapper functions can be used both with tooltips created with the AddTooltip method or the Tooltip_Add function.

David Kenny

Jean-Pierre,

I had consulted with Jose on his website regarding the information in his post here.  The tooltip demo I posted is based on what I learned from him and it does work fine.

Because FF uses the pWindow class, we need to remember to use the SetTooltipText method instead of the Tooltip_SetText wrapper function.

David