CONST True
= -1, False
= 0
t1
= _FREETIMER 'get a timer number from _FREETIMER ONLY!
FOR i
= 1 TO 100 'just a background to get and restore
RegisterToolTip "Cheese is tasty and made from moo moo cows!", 245, 100
RegisterToolTip "A fridge is the cold thing which folks hold their cheeses in!", 380, 100
PowerToolTips True, True 'This tells us to turn tool tips ON (first true), and to have it process the mouse (second true)
_PRINTSTRING (100, 100), "People like cheese in their fridge ." 'Notice we're printing once and not rebuilding the display each cycle?
_LIMIT 30 'don't melt my damn CPU
SUB PowerToolTips
(OnOff
, MouseNoMouse
) RegisteredTips(0).y = MouseNoMouse
SUB RegisterToolTip
(what$
, x
, y
) IF x
< 0 OR y
< 0 THEN EXIT SUB 'don't put your tooltip off the damn screen! IF RegisteredTips
(i
).text
= "" THEN 'it's a free tooltip spot RegisteredTips(i).text = what$
RegisteredTips(i).x = x
RegisteredTips(i).y = y
EXIT SUB 'We're done. We've registered! 'If we make it to here, we failed. Some dummy probably has more than 100 tooltips, or else they registered them inside a loop, or such.
'(Note, this dummy could be your's truly...)
IF RegisteredTips
(i
).x
= x
AND RegisteredTips
(i
).y
= y
THEN 'it's a free tooltip spot RegisteredTips(i).text = ""
RegisteredTips(i).x = -1
RegisteredTips(i).y = -1
EXIT SUB 'We're done. We've registered!
IF RegisteredTips
(i
).text
<> "" THEN _PUTIMAGE (RegisteredTips
(i
).x
, RegisteredTips
(i
).y
), Qbox
IF RegisteredTips
(i
).text
<> "" THEN 'show that damn tool tip
Background = 0
CLS , _RGB32(255, 255, 255) 'white background Bx = RegisteredTips(i).x: By = RegisteredTips(i).y - h
Background = 0