PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → WD21 - Looper Tooltip
WD21 - Looper Tooltip
Débuté par André Labuschagné, 19 juin 2017 20:31 - 8 réponses
Posté le 19 juin 2017 - 20: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?

Cheers
André
Posté le 19 juin 2017 - 22:37
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.

Cheers
André
Posté le 20 juin 2017 - 05:25
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
Posté le 20 juin 2017 - 08:24
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.
Posté le 20 juin 2017 - 11:25
André

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.

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

3.Add a procedure to the window.
PROCEDURE LprHover() 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 <= maxH THEN //Set result by deviding the MouseY position by the current row height nRes = mseY/rowH END //Extract the integer part from the result RowN is int = IntegerPart(nRes) //Increment the row number if the result decimal part is > 0 IF DecimalPart(nRes) > 0 THEN RowN ++ END Trace(StringBuild("You are hovering row %1",RowN)) END
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.
Posté le 20 juin 2017 - 14:03
Hi

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
Posté le 20 juin 2017 - 15:06
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 ELSE Trace("No data displayed") //Empty rows if 'draws the empty rows' is selected END
Job done
Posté le 20 juin 2017 - 16:30
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.

Cheers
André
Posté le 20 juin 2017 - 16:50
Solved - the LooperInfoXY did the trick. Very happy camper.