Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use of tooltips in a grid
Message
De
30/11/2020 14:55:28
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
30/11/2020 13:37:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01677292
Message ID:
01677335
Vues:
52
>>Hi Tamar,
>>
>>Results of a bit of testing:
>>
>>- if have text in two adjacent columns both with tool tip text
>>
>>a) hover over the first one but then move to the 2nd one within a second, the text from the first one persists for 5 seconds (or so) at which point it clears; text from the 2nd column does not display unless I move the mouse within that column; note that the text will clear once I move outside the grid
>>
>>b) If I change the value of _Tooltiptimeout from -1 to 0 (which is supposed to clear the text when I move the mouse), the text does not clear at all moving from column 1 to 2 - unless I move the mouse outside the grid
>>
>>Maybe this is where this needs BINDEVENT between this method and MouseMove() - or maybe this is just the result of Tooltiptext_access only firing when the mouse pointer first moves into the grid?
>>
>
>Yes, it makes sense that since we're handling this at the grid level, the access method would fire only once per entry to the grid. That should be easy enough to test with a form containing a grid that has its Tooltiptext set. Offhand, I can't think of a way that you can reset that.
>
>Tamar

One solution is a column class. It just sets grid tooltiptext while entering the column.
The problem with this is to alter all the classes for the grids.
I create all my grids during runtime, so I do not have the design time problem with the non visual column class (COLUMN and HEADER are non visual).
Eventbinding to the colums Mouseenter and Mousemove events to a method of the grid might work as well. One need to determine the column using AEVENT() and have to addprop glMousEnterRuns to the columns, but this should not be a great task.
The example below might be a start.
DEFINE CLASS SF_Column AS COLUMN	

 TOOLTIPTEXT = ''
 glMousEnterRuns = .F.
 VISIBLE = True

 PROCEDURE INIT
  LOCAL ARRAY ;
   laDlls(1,1)

  = ADLLS(laDlls)
  IF ASCAN(laDlls,'_GetCursorPos',-1,-1,2,1)=0 THEN
   DECLARE INTEGER GetCursorPos IN Win32API AS _GetCursorPos STRING @lcStr
  ENDIF &&ASCAN(ladlls,'_GetCursorPos' ...
  IF ASCAN(laDlls,'_SetCursorPos',-1,-1,2,1)=0 THEN
   DECLARE INTEGER SetCursorPos IN Win32API AS _SetCursorPos INTEGER x, INTEGER Y
  ENDIF &&ASCAN(ladlls,'_SetCursorPos' ...
 ENDPROC &&SF_Column.INIT

 PROCEDURE MOUSEENTER						&&MouseEnter für ToolTiptexte
  LPARAMETERS ;
   tnButton,;
   tnShift,;
   tnXCoord,;
   tnYCoord

*  IF VERSION(5)<800 THEN
  IF THIS.glMousEnterRuns;
    OR !THISFORM.SHOWTIPS THEN
   RETURN
  ENDIF &&THIS.glMousEnterRuns ...

  THIS.glMousEnterRuns = True

  LOCAL ;
   lcStr  AS CHARACTER,;
   lcStr2 AS CHARACTER,;
   lnX    AS INTEGER,;
   lnY    AS INTEGER

  STORE REPLICATE(dcC0,8) TO lcStr,lcStr2
  = _GetCursorPos(@lcStr)

  lnX = (((;
   ASC(SUBSTR(m.lcStr,4,1)) *256)+;
   ASC(SUBSTR(m.lcStr,3,1)))*256+ ;
   ASC(SUBSTR(m.lcStr,2,1)))*256+;
   ASC(LEFT(m.lcStr,1))
  lnY = (((;
   ASC(SUBSTR(m.lcStr,8,1)) *256)+;
   ASC(SUBSTR(m.lcStr,7,1)))*256+;
   ASC(SUBSTR(m.lcStr,6,1)))*256+;
   ASC(SUBSTR(m.lcStr,5,1))

  = _SetCursorPos(0,0)
  DOEVENTS
  WAIT '' TIMEOUT 0.01
  = _SetCursorPos(m.lnX, m.lnY)

  THIS.glMousEnterRuns = False
*  ENDIF &&VERSION(5)<800
 ENDPROC &&SF_Column.MOUSEENTER

 PROCEDURE MOUSEMOVE						&&MouseMove for ToolTiptext
  LPARAMETERS ;
   tnButton,;
   tnShift,;
   tnXCoord,;
   tnYCoord

*  IF VERSION(5)<800 THEN
  LOCAL ;
   lnWhere_Out  AS INTEGER,;
   lnRelRow_Out AS INTEGER,;
   lnRelCol_Out AS INTEGER,;
   lnView_Out   AS INTEGER

  IF THIS.glMousEnterRuns;
    OR !THISFORM.SHOWTIPS THEN
   RETURN
  ENDIF &&THIS.glMousEnterRuns ...

  THIS.glMousEnterRuns = True

  THIS.PARENT.GRIDHITTEST(m.tnXCoord, m.tnYCoord,@lnWhere_Out,@lnRelRow_Out,@lnRelCol_Out)

  DO CASE
   CASE lnWhere_Out=1
*kurze Quikinfo, Spaltenkopf
    THIS.PARENT.TOOLTIPTEXT = THIS.Header1.TOOLTIPTEXT
   OTHERWISE
*kurze Quikinfo, Spalten
    THIS.PARENT.TOOLTIPTEXT = THIS.TOOLTIPTEXT
  ENDCASE
  THIS.glMousEnterRuns = False
*  ENDIF &&VERSION(5)<800
 ENDPROC &&SF_Column.MOUSEMOVE

ENDDEFINE &&SF_Column
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform