This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
OBJECT SET HELP TIP

OBJECT SET HELP TIP 


 

OBJECT SET HELP TIP ( {* ;} object ; helpTip ) 
Parameter Type   Description
Operator in If specified, object is an object name (string)
If omitted, object is a variable
object  Form object in Object Name (if * is specified) or
Variable (if * is omitted)
helpTip  Text in Contents of help message

The OBJECT SET HELP TIP command sets or dynamically modifies the help tip associated with the object(s) designated by the object and * parameters for the current process.

If you pass the optional * parameter, this indicates that the object parameter is a form object's name (a string). If you do not pass this parameter, this indicates that the object is a variable. In this case, you pass a variable reference instead of a string.

In the helpTip parameter, pass a character string for the contents of the message. If you pass an empty string "" , the help tip will be removed.

When the form is executed, messages appear as help tips when the cursor moves over the field or object. The display delay and maximum duration of help tips can be controlled using the Tips delay and Tips duration selectors of the SET DATABASE PARAMETER command.

You can use this command with a list box object to add help tips to list box rows and cells. For example, a list box object can have a different help tip per row. In this case, you would first need to determine the position of the cursor with the LISTBOX GET CELL POSITION command. This is shown in an example below.

When a help tip is already displayed, calling the OBJECT SET HELP TIP command closes it, opens a new tip at the mouse location and restarts the Tips duration counter, allowing dynamic handling of tips.

Notes:

In this form, a help tip is displayed and changes dynamically when the mouse hovers over different parts of a picture button:

  //"myFlag" object method
 
 C_REAL($x;$y;oldX;oldY)
 C_REAL($left;$right;$top;$bottom)
 C_LONGINT($b)
 C_TEXT($tip)
 C_TEXT(oldTip)
 C_BOOLEAN($doRefresh)
 
 Case of
    :(FORM Event=On Load)
       oldTip:=""
       SET DATABASE PARAMETER(Tips enabled;1) //To make sure tips are enabled
       SET DATABASE PARAMETER(Tips delay;0) // Tip displayed immediately at mouse stop
       SET DATABASE PARAMETER(Tips duration;60*10) // 10 seconds max display
    :(FORM Event=On Mouse Move)
       GET MOUSE($x;$y;$b)
       OBJECT GET COORDINATES(*;"myFlag";$left;$top;$right;$bottom)
       $x:=$x-$left
       $y:=$y-$top
       Case of //each part of the flag is 76 pixels
          :($x<76)
             $tip:="Green color"
          :($x<152)
             $tip:="White color"
          Else
             $tip:="Orange color"
       End case
 
       $doRefresh:=($tip#oldtip//true if different tip
       If(Not($doRefresh)) //Same contents
          $doRefresh:=((Abs($x-oldX)>30)|(Abs($y-oldY)>30)) //true if cursor moved
       End if
 
       If($doRefresh//display another tip
          OBJECT SET HELP TIP(*;"myFlag";$tip)
          oldX:=$x
          oldY:=$y
          oldTip:=$tip
       End if
 
 End case

You have a list box, "Commands List", containing a list and you want to set a help tip displaying the description for each list item. The description is in the [Documentation] table. 

 C_REAL($mouseX;$mouseY;$mouseZ)
 C_LONGINT($col;$row)
 
 Case of
 
    :(FORM Event=On Mouse Enter)
 
       SET DATABASE PARAMETER(Tips delay;1) // make the tip appear quickly
 
    :(FORM Event=On Mouse Move)
 
  //#1 : find which row is hovered
 
       GET MOUSE($mouseX;$mouseY;$mouseZ)
       LISTBOX GET CELL POSITION(*;"Commands List";$mouseX;$mouseY;$col;$row)
 
  //#2 : setup the matching help tip
 
       If($row#0)
          GOTO SELECTED RECORD([Documentation];$row)
          OBJECT SET HELP TIP(*;"Commands List";[Documentation]Description) // the full description will be used as "help tip" when (if) the mouse stops moving.
       End if
 
    :(FORM Event=On Mouse Leave)
 
       SET DATABASE PARAMETER(Tips delay;3) // make the tip appear normaly
 
 End case
  

The result is...



See also 

OBJECT Get help tip
SET DATABASE PARAMETER

 
PROPERTIES 

Product: 4D
Theme: Objects (Forms)
Number: 1181

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v13
Modified: 4D v16 R4
Modified: 4D v16 R5

 
ARTICLE USAGE

4D Language Reference ( 4D v20 R7)