<p>I am working on a legacy project in <code>VC++/Win32/MFC</code>. Recently it became a requirement that the application work on a <strong>tablet pc</strong>, and this ushered in a host of new issues.
I have been able to work with, and around these issues, <strong>but am left with one wherein I could use some expert suggestions.</strong></p>

<p>I have a particular bug that is induced by the "lift" of the stylus off of the active surface. Basically the mouse cursor disappears and then reappears when you "press" it back onto the screen.</p>

<p>It makes sense that this is unaccounted for in the application. you can't <strong>lift</strong> the cursor on a desktop pc. So what I am looking for is a good overview on what happens (in terms of windows messages, etc.) when the lift occurs. Does this translate to just focus changes and mouseover events? My bug seems to also involve cursor changes (may not be lift related though). Certainly the unexpected "lift" is breaking the state of the application's tool processing.</p>

<p><strong>So the tangible questions are:</strong></p>

<ol>
<li>What happens when a stylus "lift" occurs? A press?</li>
<li>What API calls can be used to detect this? Does it just translate into standard messages with flags/values set?</li>
<li>Whats a good way to test/emulate this when your development pc is a desktop? Am I just flying blind here? (I only have periodic access to a tablet pc)</li>
<li>What represents correct behavior or best practice for tablet stylus awareness?</li>
</ol>

<p>Thanks for your consideration,
ee</p>

[{'answer_id': 80566, 'author': 'Kitty', 'author_id': 14345, 'author_profile': 'https://Stackoverflow.com/users/14345', 'pm_score': 2, 'selected': True, 'text': '<p>As a tablet user I can answer a few of your questions.</p>\n\n<p>First:</p>\n\n<blockquote>\n  <p>You cannot very easily keep a "keyboard focus" on a window when the stylus has to trail out of the focused window to push a key on the virtual keyboard.</p>\n</blockquote>\n\n<p>Most of the virtual keyboards I\'ve used (The windows tablet input panel and one under ubuntu) allow the program they are typing in to keep "keyboard focus."</p>\n\n<blockquote>\n  <p>What happens when a stylus "lift" occurs? A press?</p>\n</blockquote>\n\n<p>Under Windows, the pressure value drops, but outside of that, there is no event. (I don\'t know about linux.)</p>\n\n<blockquote>\n  <p>What API calls can be used to detect this? Does it just translate into standard messages with flags/values set?</p>\n</blockquote>\n\n<p>As mentioned above, if you can get the pressure value, you can use that.</p>\n\n<blockquote>\n  <p>Whats a good way to test/emulate this when your development pc is a desktop? Am I just flying blind here? (I only have periodic access to a tablet pc)</p>\n</blockquote>\n\n<p>When the stylus is placed down elsewhere, the global coordinates of the pointer change, so, you can emulate the sudden pointer move with anything that allows you to change the global pointer values.  (The Robot class in Java makes this fairly easy.)</p>\n\n<blockquote>\n  <p>What represents correct behavior or best practice for tablet stylus awareness?</p>\n</blockquote>\n\n<p>I\'d recommend you read what Microsoft has to say, the MSDN website has a number of excellent articles. (<a href="http://msdn.microsoft.com/en-us/library/ms704849(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms704849(VS.85).aspx</a>)\nI\'ll point out that the size of the buttons on your applications makes a HUGE difference.</p>\n\n<p>Hope this was of help.</p>\n'}, {'answer_id': 80579, 'author': 'raldi', 'author_id': 7598, 'author_profile': 'https://Stackoverflow.com/users/7598', 'pm_score': 0, 'selected': False, 'text': '<p>As I understand it, there is no "lift" event -- the only event happens when the stylus is brought back to the screen later. Of course, this depends on your specific driver and so on.</p>\n\n<p>Worse, the bug you describe might be reproducible with just a typical mouse. Try moving the mouse as fast as you can -- it will almost certainly jump several pixels at once. Or even dozens or hundreds, if you have the mouse settings configured for the highest pointer speed. One update, the mouse might be at 100,100. The very next update, it could be at 200,300.</p>\n'}, {'answer_id': 80961, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<blockquote>\n  <p>Under Windows, the pressure value drops, but outside of that, there is no event. (I don\'t know about linux.)</p>\n</blockquote>\n\n<p>Under linux you`ll get "ProximityEvents" </p>\n\n<p>Most likely these events WT_PROXIMITY are avaliable in windows  (please refer to: <a href="http://www.wacomeng.com/devsupport/ibmpc/wacomwindevfaq.html" rel="nofollow noreferrer">http://www.wacomeng.com/devsupport/ibmpc/wacomwindevfaq.html</a> )</p>\n'}, {'answer_id': 81112, 'author': 'el2iot2', 'author_id': 8668, 'author_profile': 'https://Stackoverflow.com/users/8668', 'pm_score': 0, 'selected': False, 'text': '<p>@Greg - A clarification, this is a laptop pc with integrated tablet and stylus built in. the device has no dedicated keyboard (it is a virtual one on the touchscreen) and is not a wacom input device. Sorry for the confusion.</p>\n\n<p>It appears that there is an <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=B46D4B83-A821-40BC-AA85-C9EE3D6E9699&amp;displaylang=en#RelatedLinks" rel="nofollow noreferrer">SDK</a> for the Microsoft Windows XP Tablet PC Edition that may have the ability to get special details such as pressure. However, I know that there has to be some level of standard compatibility with existing non-tablet-aware applications. I guess I can try to get Spy++ installed on the tablet and try and filter down to specific messages/events. </p>\n'}]
['https://Stackoverflow.com/questions/80518', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8668/']