Any advice about this one?
First, I tried making a tooltip as specified on the wx.chm page for wxToolTip 
as follows, and played with that a bit...

function Main()
  local XX=wx.wxToolTip("xcv")
  XX:SetTip("Zoodle\nWurdle")
  print(XX:GetTip())     --prints "Zoodle" and on new line, "Wurdle"
  print(XX:GetWindow())  --prints 'nil'.
end

Main()

I'm not sure that there is a way to attach a preconstructed tootltip to a 
window. I couldn't find one. Setting XX:Enable(true) (or false) and 
XX:SetDelay(5) failed, with some confusion about what arguments were passed.

Then I tried something based on the methods shown in the Scribble example. That 
works, given some care, but I'm not sure that it will continue to work if any 
work is done on wxLua's tooltip internals...

function OnMotion(E)
  if E:LeftIsDown() then
    PANEL:SetToolTip("")
  else
    PANEL:SetToolTip("X = "..E:GetX().."\nY = "..E:GetY())
  end
end

This is a multiline tooltip showing the current co-ordinates for the 
pointer/cursor. It's designed to stay visible, tracking the pointer motion, and 
to instantly vanish if some condition is met, and reappear if the condition 
reverts.

Two things to watch for:
1. The spaces each side of the displayed "=" signs are character ASCII 160, to 
prevent the spaces breaking the line. With real ones the tooltip forces the 
narrowest vertical form possible treating spaces as extra line breaks! 
(Provided that one real line break is in the string).
2. If I restarted the script after reversing the PANEL:SetToolTip() lines 
above, (or leaving them as is, but entering the displayed panel region for the 
first time with the left button already held down), a subsequent reverse of 
button state, while showing the tooltip as it should, produced a single-line 
tip, with the \n rendered as a small block such as a control cnaracter might be 
shown if present. I fixed this by the odd method of adding a line in the Main() 
function:

PANEL:SetToolTip(" \n").

This form is crucial for the first 'appearance' of any tooltip (it is not, (as 
is desired), actually seen at that point), the \n forces the later tooltips to 
be multiline, and the space (real this time) prevents it from later only 
showing a tiny vestigial block a couple of pixels high and wide when it's 
supposed to show a full multiline message.

For now the described method works well, but it strongly suggests that it's 
more by luck than a clearly defined behaviour, and if there is a better way to 
enforce the behaviour I want (described, and illustrated by these code examples 
when using wxLua v2.8.7.0), please tell me what it is.


PS. John, I posted that earlier reply to your reply via Gmane because I was 
still not getting any emails from the list, Gmane (and similar archives sites) 
is my only way to see, or respond, to the list, and I think Gmail was the main 
culprit judging by losses and delays of other stuff. I'm not sure if you saw my 
response. (It basically said thanks for the for loop to traverse a table of 
user data objects (very useful test flag I since added to my collection), and 
ended with a longish query about Windows' apparent delayed clearup of large 
image loads, with a query about whether wxLua, like Paint Shop, can be set to 
somehow allow any number of such loads without the image failing to render 
after just one or two attempts).


------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to