I love the Listbox.CellHelpTag which has made it nice to embed tips/tricks etc. I have noticed when using CellHelpTag it will only show when the mouse moves. I have a need for it to appear without moving the mouse.
- User double clicks on cell
- User begins to type
- User hits the space bar
- My code snippet to prevent the “space” by catching the space bar key press in my Listbiox.CellKeyDown
if key = Chr(32) then
// Prevents the user from adding “Spaces” via the spacebar key (32)
me.cellhelptag(row,column)="Sorry, spaces not allowed "
- The CellHelpTag will appear only when I nudge the mouse (it never appears if you just keep typing).
Any ideas would be appreciated
Thank you in advance!
Does it appear immediately if you instead create a tooltip manually using the ToolTip class?
Thanks Paul! I will try that now.
Paul it acts the same way that cellhelptag did. You must slightly move the mouse for the box to appear. Any McGyver ideas? I’m still tinkering and thanks again!
Not really. They just use the OS default for these things and perhaps mouse movement is required.
Perhaps a tooltip is not the best thing to use for this, then. Maybe you could just show a Canvas with the error text instead and then hide it after they continue typing?
Thanks Paul as I have been playing with a Declare to try and just nudge the mouse. Better idea for the canvas
Hmmm… Weird. I closed Xojo when I was committing my code and then restarted Xojo. I then tried the tooltip code and it now is working as I needed (The Box auto appears without having to move the mouse).
Tooltip is showing nicely without having to move my mouse.
This code does move your mouse for you, but Ironically it still didn’t force Listbox.CellHelpTag to pop it’s message
Declare Sub movecursor Lib "Cocoa" alias "CGDisplayMoveCursorToPoint" (CGDirectDisplayID as single, x as single, y as single)
Final Code that allows me to pop a nice message to inform the user that spaces are not accepted. Once the user continues to type the message automatically goes away. For some reason I couldn’t get autohide to work with boolean=True, but oh well.
If key = Chr(32) then // Recognizes when the space bar is pressed
Tooltip.Show("Sorry, spaces not allowed", System.MouseX, System.MouseY, False)