KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Displaying a variable object when hovering over a List Box cell as a help tip
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac & Win
Published On: November 15, 2016

The help tip feature for objects such as "Variable" and "Button" can be seen when a mouse pointer is hovered over the object. To bring this similar functionality to a List Box, it can be done with a "Variable" object and the use of Tech Tip # 77135. Here are the steps for to apply:

1. Obtaining the Variable width and height at the form "on Load" event:

Case of
   : (Form event=On Load)

   // Code for initializing the List Box columns

   // Width and Height of the Variable object
   C_LONGINT($leftV;$topV;$rightV;$bottomV;widthV;heightV)
   OBJECT GET COORDINATES(*;"Variable";$leftV;$topV;$rightV;$bottomV)
   widthV:=$rightV-$leftV
   heightV:=$bottomV-$topV

   Variable:=""

End case


2. Apply Tech Tip #77135 on setting up the List Box to hover.

3. Add the following code in LISTBOX_HIGHLIGHT_CELL from Tech Tip #77135:

// Highlight the particular cell (Code already in method)
LISTBOX SET ROW COLOR(*;arrColNames{$i};$rowNum;0x003875D7;Listbox background color)

C_LONGINT($leftC;$topC;$rightC;$bottomC)
LISTBOX GET CELL COORDINATES(*;"List Box";$i;$rowNum;$leftC;$topC;$rightC;$bottomC)

If (($rowNum>0) & ($rowNum<=(size of array(Column1))))
   OBJECT SET VISIBLE(*;"Variable";true)
   Variable:="Row: "+String($rowNum)+" Col: "+String($i)
   OBJECT SET COORDINATES(*;"Variable";$rightC+1;$topC-heightV;$rightC+widthV;$topC)
Else
   object set visible(*;"Variable";false)
End if

// (Code already in method)
$i:=Size of array(arrColNames)+1


Example of a form that displays a "Variable" object that is moved next to the hovered cell to report Row and Column location:


See Also: