Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 12 Monaten
Letzter Beitrag:
vor 12 Monaten
Beteiligte Autoren:
André Labuschagné, DerekT, Fabrice Harari, Robert Willis

WD21 - Looper Tooltip

Startbeitrag von André Labuschagné am 19.06.2017 18:31

Hi All

I am wanting to display a tooltip when the cursors hovers over a looper and the tooltip must change for each "row" in the looper. Is there any way to achieve this?



This is extremely disappointing. Standard stuff this - displaying a tooltip when a row is hovered over. I have been able to assign a tooltip for the ATT for the control for each row in the looper. But when hovering over each row in the looper I cannot establish which row is being hovered over and hence cannot retrieve the tooltip. Not good.

Any ideas welcome - even if it is just not doable.


von André Labuschagné - am 19.06.2017 20:37
Unfortunately, I've been trying for a while as I have a use for this to save a click. Tooltip is not one of the attributes available in the looper's logic and every attempt has ended poorly. If I ever figure it out I'll pass along. I'm just now starting on v22 and see if there's any improvements

von Robert Willis - am 20.06.2017 03:25
Thanks Robert. If I can ascertain a way of establishing what *row* has been touched or hovered over and *not* selected I will have a firm solution. But without a click there is no way of knowing which tooltip to display.

Please let us know if you do ever get a solution.

von André Labuschagné - am 20.06.2017 06:24

It can be done but I have to admit it is a bit of a flaff.

1. On the looper add a static (hidden) - needs to be the same height as a row, width not important.
Set attribute (attH) to return the height value.
Set anchor - By Height - to allow for window resizing.

2. In the code block of the looper add a 'Mouse Rollover' section.

3.Add a procedure to the window.

nRes is currency
rowH,maxH,mseY is int
//Only run if looper has content
IF LooperCount(lpr_arrAssociates) > 0 THEN
//Test for the height of the looper rows
rowH = lpr_arrAssociates[1].attH
//Calculate the max value for 'mseY' based on number of rows
maxH = rowH * lpr_arrAssociates..Occurrence
//Position of mouse whilst hovering
mseY = MouseYPos()
//Check mouse is within the populated rows of the looper
IF mseY 0
IF DecimalPart(nRes) > 0 THEN
RowN ++

Trace(StringBuild("You are hovering row %1",RowN))

4. Call the procedure in the Mouse Rollover' code block.

Tried on a couple of loopers on my test app and it does return the correct result.

If you have the 'tooltip' part already to go then may well be worth a trial of the above.

von DerekT - am 20.06.2017 09:25

I haven't tried, but it seems to me that it should be quite easy using looperinfoXY...

You first get the XY coordinates using the mouse functions, then you ask the looper what row is in that position, and then you change the looper tooltip

Best regards

von Fabrice Harari - am 20.06.2017 12:03
Good spot Fabrice.
I had overlooked LooperInfoXY

So Plan B

1. In the code block of the looper add a 'Mouse Rollover' section and enter the following code.
//Get mouse position coordinates
lprX is int = MouseXPos()
lprY is int = MouseYPos()
//Returns the current hovered row
RowN is int = LooperInfoXY(lpr_arrAssociates, liLineNumber, lprX, lprY)

IF RowN >= 1 THEN
Trace(StringBuild("You are hovering row %1",RowN)) //Current row
Trace("No data displayed") //Empty rows if 'draws the empty rows' is selected

Job done

von DerekT - am 20.06.2017 13:06
Derek and Fabrice

Excellent - I thought that LooperInfoXY required an explicit clik on the part of the user other than a simple hover - the help starts with click so I skipped it - another case of Frenglish. Will try that right now. Will try Plan A and B.


von André Labuschagné - am 20.06.2017 14:30
Solved - the LooperInfoXY did the trick. Very happy camper.

von André Labuschagné - am 20.06.2017 14:50
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.