Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 13 of 23

VRC 4000 Software Driver Manual: Chapter 2 TBDriver Touchscreen Driver for DOS, pages 113 to 122

Pages 113 to 122 of 206, from VRC 4000 Software Driver Manual

The original document is the PDF (1.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Symbol VRC-4000

Page 113

Chapter 2: TBDriver Touchscreen Driver for DOS

TBMOUSE - The Mouse Emulator TBmouse enables a touchscreen to drive programs which normally use a mouse. TBmouse interfaces with the touchscreen through TBdriver, and emulates the interrupt 33 mouse function calls. Programs vary as to how well they lend themselves to being adapted to a touchscreen in this way. There can be no doubt that a true touchscreen user interface differs fundamentally in design from one designed for a mouse. Nevertheless, in some cases, mouse emulation through touch can be effective. Experience has shown that success is only feasible for applications which make use of a single button. Techniques which attempt to simulate both buttons are impractical, so TBmouse supports only the left button. Please be aware that there is a significant difference between the positional data reported by a mouse and a touchscreen: A touchscreen reports the absolute position of a touch on the video screen, whereas a mouse reports horizontal and vertical motion relative to its previous position. Mouse software therefore, at some stage, converts the relative motion of the mouse to an absolute screen position. At this point, applications divide into two types, those which perform their own conversion from mouse motion to absolute screen position, and those which allow the mouse driver to do it for them and read absolute coordinates from the mouse driver. The latter of these two are the straightforward cases - since they expect absolute coordinates they are ideally suited to work with a touchscreen. It is those applications which work with mouse motion which often present difficulties, sometimes insurmountable.

2-71

Page 114

VRC 4000 Software Driver Manual

The TBmouse Command Line You must load TBdriver before loading TBmouse. You may optionally also load a standard mouse driver before loading TBmouse. If you do, you will be able to use the mouse as well as the touchscreen. If you don't, there will be no mouse cursor, unless the application generates its own. TBmouseMode [/R] [/Z] [/Q] [/C] [/I] [/L] [/O] [/N] [/S:xxxx,yyyy] [/P:xxxx,yyyy] [/M:xx,yy] [/K:size]

Mode /R /Z /Q /C /I /L /O /N /S:xxxx,yyyy /P:xxxx,yyyy /M:xx,yy /K:size

Specifies a button mode: 1, 2, 3, 4 or 6 Relative cursor movement Use Z axis Quiet mode, no sound Suppress Cursor Incremental motion Treat x,y Limits as scales Ignore touches outside x,y limits No stack swap when calling user ISR Set initial virtual screen Size Set initial cursor Position Set initial Mickey to pixel ratios size of User ISR stack. Default 500 bytes

TBmouse /? TBmouse U

Displays the above summary Unloads TBmouse from memory

Again, most of these options are only required in special circumstances. TBmouse is normally loaded by typing: TBmouse 1 or TBmouse 2

2-72 for button mode 1 for button mode 2, etc.

Page 115

Chapter 2: TBDriver Touchscreen Driver for DOS

Button Emulation Modes TBmouse provides several different modes of mouse button usage. Experimentation quickly determines the most appropriate mode for a particular application. In mode 1, when you touch the screen, the mouse cursor is moved to the point of the touch, and the left button is immediately pressed down. You can then slide around with the left button held down. The button is released when you remove your finger from the screen. In mode 2, when you touch the screen, the mouse cursor is moved to the point of the touch, but the button is not pressed. You can then slide around with the left button not pressed. Any time you hold your finger stationary for about half a second, the left button is pressed, and two short beeps are sounded. Once pressed, you can slide around with the button pressed, and the button is only released when you remove your finger from the screen. Mode 3 is similar to mode 2, but rapid double clicks are possible. After holding stationary to generate a button press, you quickly lift your finger off the screen and then immediately touch it again. A single beep sounds, and a second button press is generated immediately at the same location as the first one. In mode 4, button presses are generated by quickly lifting your finger off the screen and putting it back on again. Mode 5 is reserved for future use. In mode 6, button presses are generated when you lift your finger off the screen.

The Mouse Cursor In some applications the mouse cursor may no longer be relevant when using a touchscreen, so the /C parameter can be used to disable it. TBmouse can only disable the mouse cursor if the application allows the mouse driver to handle cursor display. Some applications generate their own cursor internally, in which case TBmouse cannot suppress it.

2-73

Page 116

VRC 4000 Software Driver Manual

If you don't disable it, TBmouse allows the normal mouse driver to handle the cursor. Therefore if you use TBmouse without a mouse driver loaded, no cursor will be displayed unless the application generates its own.

Absolute Mode By default, TBmouse operates in absolute mode, and attempts to maintain the mouse cursor at the exact position of your touch. When you touch the screen, the mouse cursor immediately jumps to a position directly under your finger, and follows your finger as you slide around. Unfortunately, this is not possible with some applications, especially sophisticated ones which have their own internal algorithms for translating relative mouse movement to cursor movement. You can experiment with various scales and mickey to pixel ratios, but some applications will resolutely refuse to cooperate. For such cases, relative mode is the solution.

Relative Mode If you specify the /R switch when you load TBmouse, you can “pick up” the cursor anywhere on the screen, and it will move relative to your finger. In other words, if you move your finger to the left, the cursor moves to the left, even though it may be nowhere near your finger. This has the advantage that you can see the cursor clearly, just as you can when using a mouse. Also in this mode, the relative motion of the cursor is reduced when you move your finger slowly, which considerably improves precision.

The Mickey to Pixel Ratio The unit of mouse motion is the Mickey: Older mice had about 200 mickeys to the inch, whereas newer mice have about 400 mickeys to the inch. A real mouse driver converts mouse motion in mickeys to movement in screen pixels using the “mickey to pixel ratio”. The interrupt 33 mouse API is very rich and applications can use numerous different techniques to obtain mouse position information. Fundamentally though, the choice is between reading relative motion in Mickeys, or absolute coordinates on the mouse “virtual screen”. Applications which read Mickeys are the most difficult to accommodate via a touchscreen, yet they are all too common.

2-74

Page 117

Chapter 2: TBDriver Touchscreen Driver for DOS

When an application reads relative mouse motion in mickeys, it must perform its own internal conversion of the motion to absolute screen coordinates, and draw its cursor or activate functions accordingly. In order to provide mouse emulation for such applications, TBmouse must convert the absolute position of touches to relative motion in mickeys, and supply the correct number of mickeys, with the correct polarity, to the application. In order to provide accurate calibration, TBmouse's conversion of absolute coordinates to mickeys must be exactly identical to the application's conversion of mickeys back to absolute coordinates. Although this may seem simple enough, unfortunately, TBmouse does not always know what “Mickey to Pixel” ratio the application is using internally. TBmouse's /M switch is provided to supply this to TBmouse, and in many cases the correct values must be determined by trial and error. The mickey to pixel ratio is expressed as the number of mickeys required to move 8 pixels. The default is 8 mickeys to 8 pixels horizontally (ie 1 to 1), and 16 mickeys to 8 pixels vertically (ie 2 to 1). The default /M parameter is therefore /M:8,16. Increasing the numerical values increases the movement of the cursor for a given touch offset. For example, specifying /M:16,32 means that any given relative touch movement will generate twice as many mickeys as the default, which in turn will generate twice as much motion of the application cursor.

2-75

Page 118

VRC 4000 Software Driver Manual

Initial Virtual Screen Size The mickey to pixel ratio defines the ratio of motion in mickeys to movement in pixels. The “pixels” referred to here are not physical screen pixels, but pixels on a “virtual screen”. The mouse virtual screen size is officially defined for each video mode in the Microsoft Mouse documentation, and does not always correspond with the number of physical pixels on the screen. To make matters worse, applications reading mouse motion in mickeys are not concerned with the mouse driver's internal virtual screen size, and might use a virtual screen which corresponds with neither the official mouse virtual screen size, nor the number of pixels on the physical screen! TBmouse's /S parameter allows you to override the default virtual screen size, and has a corresponding effect on the mickey to pixel conversion. For example, if the virtual screen size is 640 x 200 (/S:640,200) and the mickey to pixel ratio is 8,16 (/M:8,16), touching two points at opposite sides of the screen will generate 640 mickeys of horizontal motion. With a virtual screen size of 800 x 600 and the same mickey to pixel ratio, touching the same two points would generate 800 mickeys of horizontal motion. Using the /M and /S parameters, an infinite variety of mickey to pixel conversion ratios are achievable, although it can be very time-consuming to experiment with them all.

Initial cursor position The /P switch enables you to specify the initial cursor position following a mouse reset function. The default position is the centre of the screen, but this is not correct for all applications. The x and y values must be specified in terms of the virtual screen size in use for the video mode used by the application.

Incremental Motion The /I switch causes TBmouse to limit the emulated mouse motion to a maximum of 127 mickeys at a time. This switch is required when running applications written using older versions of MetaWindows.

2-76

Page 119

Chapter 2: TBDriver Touchscreen Driver for DOS

Alternate Interpretation of x,y Limits The /L switch causes TBmouse to interpret mouse functions 7 and 8 (Set Minimum and Maximum Cursor Position) differently. By default, these are interpreted (correctly) as restricting the movement of the cursor to a sub-area of the screen. However, some applications use these calls to effect a scaling of incoming mouse coordinates and then apply these to the full screen. Using /L will emulate this quirk.

Ignoring Touches Outside x,y Limits Normally, TBmouse interprets touches outside the x,y limits specified by mouse calls 7 and 8 as touches on the extreme edge of the defined area. The / O switch causes TBmouse to ignore such touches instead. This may be desirable for some applications.

Stack Switching Normally, TBmouse switches to its own internal stack prior to calling a mouse user ISR. The /N switch enables you to prevent TBmouse from switching to its internal stack before calling an application user ISR, in which case the application will have whatever stack happened to be current when the ISR needed to be called. Do not use this switch unless you have good reason. The /K switch allows you to specify the size of the user ISR stack. The default is 500 bytes.

The Z Axis For touchscreens which have a Z axis, the /Z switch causes TBmouse to look for a hard press instead of a stationary touch in button modes 2 and 3.

Acceleration and Other Problems Unfortunately, there are some applications which cannot successfully work with a touchscreen mouse emulator. This occurs in the following circumstances: 1. The mickey to pixel ratio used by applications is sometimes not linear: Acceleration is often implemented so that the mouse cursor moves a greater distance when the mouse is moved quickly than when it is moved 2-77

Page 120

VRC 4000 Software Driver Manual slowly. If the application implements acceleration, the touchscreen driver has little chance of calculating the correct number of mickeys required to simulate the correct movement, since touches any distance apart represent extremely rapid movement and will always invoke maximum acceleration. 2. Sometimes, applications move their internal mouse pointer without informing the mouse driver, for example when changing screens or entering a different sub-program from a menu. In such cases, TBmouse will then calculate the wrong mouse motion for the next touch, and the cursor will get out of calibration with the touchscreen. Calibration can usually be regained by pushing the mouse cursor into a corner, but this is not really satisfactory. 3. Sometimes, applications use different mickey to pixel ratios or different virtual screen sizes in different sub-programs. This is especially true of large systems (for example some Executive Information Systems) where presumably different programming teams handled each sub-program.

Unloading TBmouse TBmouse can be unloaded from memory by typing: TBmouse u

TBdriver can then be unloaded if required.

TBmouse Messages TBmouse displays the following messages: • Warning - no mouse driver loaded

There will be no mouse cursor. • Can't load - TBdriver not loaded

TBmouse cannot be used without the touch screen driver. • Can't load - already loaded

You tried to load TBmouse, but it is already loaded. • Invalid mode number

You specified an unsupported button mode number. 2-78

Page 121

Chapter 2: TBDriver Touchscreen Driver for DOS

• Can't unload - not loaded

You requested TBmouse to unload, but it was not loaded. • Can't unload - vectors have been hooked

You requested TBmouse to unload, but another program has loaded after TBmouse and hooked interrupt vector 33. Unload the second program first, then you can unload TBmouse. • /Z ignored - no Z axis

The /z switch is only used if TBdriver reports that it is driving a touchscreen with a Z axis. • Invalid virtual screen size

The values specified with the /s switch are invalid. They must be in the range 1 to 9999, and must both be specified. • Invalid mickey to pixel values

The values specified with the /m switch are invalid. They must be in the range 1 to 99, and must both be specified. • Invalid initial cursor position

The values specified with the /P switch are invalid. They must be in the range 0 to 9999, and must both be specified. • Invalid stack size

The value specified with the /K switch is invalid. It must be in the range 0 to 9999. • TBmouse unloaded from memory

TBmouse has been removed from memory at your request. • TBmouse made resident

TBmouse has been successfully loaded into memory, and is ready for use.

2-79

Page 122

VRC 4000 Software Driver Manual

Return Codes The commands to load and unload TBmouse will often be placed in batch files. To facilitate this, TBmouse returns the following error levels: 0 - Loaded or unloaded successfully 1 - Can't load - already loaded 2 - Can't unload - not loaded 3 - Can't unload - vectors have been hooked 4 - Can't load - TBdriver not loaded 5 - Invalid mode number 6 - No parameters 7 - Invalid initial scales 8 - Invalid mickey to pixel values 10 - Invalid initial cursor position 11 - Invalid stack size

2-80