Problems Getting Started
Where can I find sample code for Wintab?
There are many sample code examples for the use of Wintab. You will find links to these examples on GitHub: https://github.com/Wacom-Developer/wacom-device-kit-windows.
Why do I suddenly stop receiving WT_PACKET messages from the tablet or seem to only get some of the tablet packets?
You are probably missing tablet packets because your context's packet queue is overflowing. Each Wintab context has a queue of tablet packets. Wintab only adds new packets to the queue and sends your application a WT_PACKET message if the queue is not full. If the queue is full, Wintab discards the packet and does not send your application a WT_PACKET message to tell you that your context received a tablet packet.
You can help prevent the queue from overflowing by always removing packets from the queue when you receive a WT_PACKET message and by flushing the queue when you receive WT_PROXIMITY messages.
You can flush the queue by calling:
WTPacketsGet(hWintabContext, VALUE_LARGER_THAN_YOUR_QUEUE_SIZE, NULL);
orWTPacket(hWintabContext, wPacketSerialNumber, NULL);
Why does/doesn't the screen cursor move when I use the tablet while my application is running?
The CXO_SYSTEM bit of the lcOptions field of your logical context controls whether Wintab moves the system pointer (screen cursor) when your context receives tablet data. If this bit is not set, then Wintab will not move the system cursor when your application is active. If you use WTInfo(WTI_DEFCONTEXT, …) to get context information with which to create your own context, CXO_SYSTEM will be clear unless you set it before calling WTOpen().
LOGCONTEXT wintabLogicalContext;
wWTInfoRetVal = WTInfo(WTI_DEFSYSCTX, 0, &wintabLogicalContext);
wintabLogicalContext.lcOptions |= CXO_SYSTEM;
hWintabContext = WTOpen(hWnd, &wintabLogicalContext, TRUE);
If you use WTInfo(WTI_DEFSYSCTX,...) to get context information with which to create your own context, CXO_SYSTEM will be set and the cursor will move when your application is active.
Problems Getting Specific Data
How can I tell if an attached tablet is a Wacom tablet?
There is no way to tell if an attached tablet is truly a Wacom tablet. The good news is that you shouldn't need to as using the WTInfo() function allows you to find what data items are supported by the tablet and what their ranges will be.
How can I tell which Wacom tablet model is being used?
There is no way to tell which tablet model is installed on the machine. This intentional abstraction allows for applications to be written to work with any device.
How can I get pen altitude, azimuth, and twist data?
The standard Pro Pen or Pro Pen 2 should give you altitude and azimuth. The Wintab TiltTest demo from our developer site shows an example of how to do this. You will only get twist data if you use an Art pen, which can be verified from the same app.
How can I find out how many (if any) tablets are plugged in?
WTInfo(WTI_INTERFACE, IFC_NDEVICES, &numDevices) will return the number of connected tablets or zero.
Does Wintab support WTX_TILT?
No, our implementation of Wintab does not support the WTX_TILT extension. However, most modern pens will give you altitude and azimuth, from which you can calculate tilt (see the Wintab TiltTest demo).
Why can't I get the full tablet extended range of values?
The tablets are manufactured with a small portion of the tablet active area under a margin around the drawing area. This serves to drastically improve pen accuracy at the edges of the tablet.
How can I get low-level interface documentation for Wacom tablets?
You normally can't because this is proprietary information that can only be released under an Non-Disclosure Agreement (NDA). You should not need such information because Wintab supports obtaining tablet pen data without the need for low-level details.
What Wintab function do I use to retrieve PACKETEXT data?
If your application has set up to retrieve PACKETEXT data, use WTPacket() to query for data in response to WT_PACKETEXT messages. See the Wintab Tablet Controls sample code for an example.
Can my application retrieve a tablet-to-screen user preferences mapping through Wintab?
No, Wintab goes to great lengths to hide that mapping, which allows an application to not have to deal with tablet-to-screen mappings for preferences set outside of an application's context. Wintab supports letting an application set its tablet-to-screen mapping anyway it wants – which overrides the preferences settings.
Why does the Win32 function, GetRawInputData() not work with a Wacom tablet?
This function does not work because it cannot read the tablet driver's custom pen data collections.
Problems With Compatibility
Can WinTab be used in UWP applications?
Due to limitations of UWP, no. We would suggest using the Windows Ink API instead in this case.
Can I use the .NET InkCollector object to obtain pen data from my tablet?
Yes, please see the Windows Ink API for more information.
How can I use tablet data with web applications?
You can use the HTML5 pointer events or the WILL SDK to extract pen location, pressure, rotation, orientation, and tilt data. See Web API for more information.
Is there a Wintab .NET API?
There is now a .NET API for Wintab. You can access the Wintab .NET API, which includes documentation and sample code.
General Questions
If the user uses the Wacom Tablet Properties to customize my application or a tool (for example, sets only a portion of tablet active), the customized setting always affects my application. Is this a bug, by design, and can I stop it?
One of the design goals of our products was to give the user maximum flexibility and control over the behavior of the tablet. Part of this control is application- and cursor-/tool- specific settings. There is, of course, a tension between allowing the user to customize settings for applications or tools and application code needing to set settings so that their applications work as the application vendors intended.
Graphics tablet applications can be generally divided into two categories: those that need tablet coordinates mapped to the physical coordinate space they request; and those that don't. CAD applications, digitizing applications, and template utilities are examples of the first kind of application. Painting and drawing programs are examples of the second kind of application. There are many more applications in the second category than in the first.
In most cases, the Wacom Wintab lets the user's custom settings override the settings the application makes using the Wintab API. However, to accommodate CAD and other applications in the second category, the Wacom Wintab will let the application's Wintab context settings override the user's custom settings if the application opens a Wintab context with any of these characteristics:
- The context has any bits set in lcLocks.
- The application changes the tablet input origin (lcInOrgX, lcInOrgY or lcInOrgZ).
- The application changes the tablet input size (extents) (lcInExtX, lcInExtY or lcInExtZ).
- The application changes the screen origin (lcSysOrgX or lcSysOrgY).
- The application changes the screen output size (extents) (lcSysOrgX or lcSysOrgY).
- The application sets the screen cursor to move in relative mode (sets lcSysMode to non-zero).
How can I map tablet area to application pixel area?
Some examples of how to map tablet to display pixels can be found in the Wintab ScribbleDemo sample code, which performs this mapping in the WM_SIZE message handler. There, the code computes scaling factors, scaleWidth and scaleHeight, that are later used when rendering tablet data in the WM_PAINT message handler.
CMFC_DEMOView::OnCreate
{
// Get default context information
// Be sure to use default digital context for data packets before
// calling gpWTOpenA.
gpWTInfoA(WTI_DEFCONTEXT, 0, &lc);
...
gpWTOpenA(...);
...
}
CMFC_DEMOView::OnWTPacket
{
...
POINT csr;
...
// Read the packet to get tablet coordinates.
PACKET pkt;
gpWTPacket((HCTX)hCtx, wSerial, &pkt);
...
// Get window size to get pixel extents.
RECT window_rect;
GetWindowRect(&window_rect);
POINT size;
size.x = window_rect.right - window_rect.left;
size.y = window_rect.bottom - window_rect.top;
...
// Compute point in pixel space using tablet position data
csr.x = (size.x * pkt.pkX) / lc.lcInExtX;
csr.y = size.y - (size.y * pkt.pkY) / lc.lcInExtY;
...
}
Where can I find out about Linux tablet programming?
Visit the Linux Wacom Project or OpenSolaris Archive for support.
How can I program an STU-300, STU-500, or STU-520 Signature (signpad) Tablet?
Here is where you can obtain information about Wacom's Signature Solution.
What tool can I use to determine if a tablet is sending messages?
The hclient tool, in the WinDDK, is a good way to determine if your tablet is sending pen messages. This tool does not rely on Wintab; rather it connects to a tablet's HID descriptor, and can monitor tablet data as it is sent from the HID kernel stack. Simply select the device from the list of HID devices that hclient has enumerated (note that the Vendor ID = 0x56a, which is for Wacom). Make sure that the Usage Page = 0xD, and the Usage = 0x1. Press the "Blocked Read Data" button at the bottom of the dialog, and press the "Continuous Asynchronous Read" button when the data dialog comes up. Touch the pen to the tablet to see the data.
How can my application have exclusive access to all tablet pen events?
You must force your application to be the front-most (foreground) app.
What are some of the pros and cons of using Wintab over one of the Microsoft Ink APIs in my app?
Both Wintab and the Microsoft Ink APIs support the delivery of ink-enabled Wacom device data to your application. However, before choosing which API to use, you may want to consider these points:
Wintab API
Pros
- Wacom has a 35-year history of integrating the Wintab API tightly into its tablet drivers.
- It is a very stable API.
- Wacom tablet driver components use Wintab (so we "eat our own dogfood").
- We take our Wintab ISVs seriously and assign engineering resources to analyze reported problems.
- We work with ISVs and developers to get the best user experience possible from Wintab.
- Wintab is not subject to any of the problems that have been plaguing Windows 10 ink in recent years (see Windows Ink FAQs).
- The Wintab API philosophy is: "write-once, use-for-all-tablets."
- The Wintab API supports all Wacom ink-enabled devices (listed on Wintab - Overview).
- Wacom feels that a Wintab-enabled app provides a better overall inking experience for the user.
- Support for C, C++ and .NET (C#) programming languages, and any framework that can import a Windows DLL as well.
- The Wintab API supports the capture of ink data on display tablets and devices (e.g. Wacom display tablets, Tablet PCs), as well as opaque (non-display, such as Intuos) tablets.
Cons
- The Wintab API is rich and exposes a level of detail that takes some time to learn. Hopefully the information provided on these pages will help the developer ramp up quickly.
- The Wintab API does not have the kinds of high-level APIs provided by the Microsoft Ink APIs (such as InkCanvas, stroke management, handwriting analysis, etc.).
- The Wintab API is not being directly supported by Microsoft. As a result, Wintab is not a tightly woven part of the Windows infrastructure.
- The Wintab API is supported only on ink-enabled Wacom devices and those OEM devices using Wacom pen sensors and driver.
Microsoft Ink APIs
Pros
- The Microsoft Ink APIs have been evolving since Tablet PC days (Windows XP era) into the current Windows 10 variants.
- There is support for adding ink using a large selection of ink objects (see Windows Ink - Reference).
- It is relatively easy to add ink support to an app with a minimum of effort.
- There is extensive documentation and samples on using Microsoft Ink APIs.
- The Microsoft Ink APIs are well-integrated well into the various types of apps that can be built with Visual Studio.
- There is support for both C++ and .NET (C#) programming languages.
- The Microsoft Ink APIs are supported across a range of ink-enabled devices in the industry.
- It is optimized for signature and stroke capture.
Cons
- There have been ink-related bugs that Microsoft introduced with the Windows 10 Creative release (see Windows Ink - FAQs).
- Microsoft Ink has not focused on the quality of ink to the extent that Wintab has. Sometimes the ink behavior just "gets in the way." A prime example is Press-and-hold-to-right-click (PHRC) behavior interfering with fine-grained graphics input during stippling (small ink dot) operations. Since the APIs are stroke-based, PHRC causes problems for operations that expect discrete ink, such as stippling.
- It is somewhat challenging to navigate the Microsoft Ink API namespace to determine the best ink API to use (but Windows Ink Dev Docs should help with that; the Overview page is here: Windows Ink - Overview).
- The Microsoft Ink APIs do not provide fine-grain control of mapping tablet to display coordinate space as does the Wintab API.