x,y position of the mousechunk ?

jbv at mozik.fr jbv at mozik.fr
Tue May 5 02:40:48 EDT 2026


Le 2026-05-04 15:22, J. Landman Gay via use-livecode a écrit :
> Can you share the workaround?


So, I have a custom data grid with 2000 rows, each row is a sub-group 
with 1 checkbox and 6 fields. Each row can have a different height 
according to the HTMLtext in the fields (dontwrap is false, so the 
HTMLtext can look like more than 1 line).
On mousemove, when the mousetext corresponds to an entry in an array, a 
custom tooltip is displayed with specific content, and positioned at the 
top right corner of the chunk, otherwise the tooltip is hidden.

on mousemove
	get the mousetext
	if the keys of Tarray[it] is not empty then
		lock screen
		put the mousechunk into c
		put last word of c into f
		put top of fld f into ft
		put the mouseloc into m
		put the textHeight of fld f into th
		put the margins of fld f into mg
		put trunc((item 2 of m - (ft + mg)) / th) into z
		put (4 + ft + (th * z)) into b
		put the HTMLtext of fld f into temp

		if z = 0 then	--	only 1 line
			put "1" into word 2 of c
			put ("put $" & (the value of c) & "$ into fld " & f) into z
			replace "$" with quote in z
			do z
			put the formattedwidth of fld f into x
			put (left of fld f + x - 2) into l

		else	--	multiple lines

			put (item 1 of m) - (left of fld f) - mg into xx
			put c into d
			put 1 into word 2 of d
			put the value of d into v
			put number of words of v into n
			repeat with i = n down to 1
				put word i to n of v into fld f
				put (the formattedwidth of fld f) - (mg * 2) into w
				if w >= xx then
					put w + (left of fld f) + (mg * 2) into l
					exit repeat
				end if
			end repeat
		end if
		--	displays the tooltip
		set bottom of grp st to b
		set left of grp st to l
		show grp st
		set the HTMLtext of fld f to temp
	else
		--	hides the tooltip
		hide grp st
	end if
end mousemove

This runs fast on an old iMac Intel from 2012 with LC 9.6.3.


More information about the use-livecode mailing list