Signature Tablet Widget¶
- Signature Tablet Widget
- Introduction
- Conversion
- Runtime
- Signature Pad Simulator
- Prerequisites
- Step 1: enable simulation mode in the directory
- Step 2: make tablet.sigwebtablet.com resolve to the loopback address
- Step 3: make the browser accept the simulator certificate
- Step 4: start the server and check the log
- Step 5: use the simulator
- Optional configuration
- Troubleshooting
- Limitations
- Examples
Introduction¶
Topaz Signature Pad devices are used in retail/point of sale (POS) systems to capture a customer's signature as an image. In #4202, support was added for usage of these devices in a web environment. At this time, FWD provides the following:
- There is a new widget in FWD (
SIGNATURE) that provides signature tablet support. - 4GL code written to use the .NET SDK can be moved to this new widget: the widget methods have the same names and arguments as the .NET SDK methods (see "Enabling Conversion from .NET" below).
- At runtime, the signature tablet usage is implemented in the browser via JavaScript using the Web SDK (SigWeb).
- A signature pad simulator (#11409) lets developers and testers use the widget without a physical pad: the FWD server simulates the SigWeb service and the user signs with the mouse.
This support is available starting in FWD v4. The signature pad simulator is available starting in FWD trunk rev 16820.
The widget is implemented only for the Web GUI client. Development was done in #4202.
Conversion¶
Supported API Features¶
The signature widget is a dynamic widget. It is created with the CREATE SIGNATURE statement (a FWD extension of the 4GL), there is no static (DEFINE / VIEW-AS) form:
DEFINE VARIABLE hSig AS HANDLE NO-UNDO.
CREATE SIGNATURE hSig
ASSIGN FRAME = FRAME fMain:HANDLE
X = 12
Y = 96
WIDTH-PIXELS = 400
HEIGHT-PIXELS = 300
SENSITIVE = TRUE
VISIBLE = TRUE.
The usual widget attributes (NAME, FRAME, X, Y, WIDTH-PIXELS, HEIGHT-PIXELS, VISIBLE, SENSITIVE, BGCOLOR-RGB, FGCOLOR-RGB and so on) apply. The converted code uses the com.goldencode.p2j.ui.Signature interface, implemented by SignatureWidget.
Events
| Event | When it is raised |
|---|---|
PEN-DOWN |
The pen touches the pad (in the simulator: the left mouse button is pressed on the widget). |
PEN-UP |
The pen is lifted from the pad (in the simulator: the left mouse button is released, or the pointer leaves the widget while the button is held). |
The events are raised only while the widget is visible and the tablet is on (SetTabletState(1)). They are used with the usual trigger syntax, for example ON "PEN-UP" OF hSig DO: ... END. A PEN-UP trigger is the natural place to check hot spot taps (KeyPadQueryHotSpot) and the amount of ink (NumberOfTabletPoints).
Methods
All methods are FWD extensions of the 4GL; the names are case-insensitive. Each 4GL method has the same name and arguments as the method of the Topaz .NET SDK (Topaz.SigPlusNET), except GetSignatureImage (see the notes). At runtime, each call is forwarded to the SigWeb function of the same name in the browser.
| 4GL method | Java method | Description |
|---|---|---|
SetTabletState(state) |
setTabletState |
1 turns the tablet on (signature capture and pen events), 0 turns it off. Call it with 1 before any other call that reads data from the pad. |
TabletModelNumber() |
tabletModelNumber |
Returns the model number as CHARACTER: 1 = TL766, 8 = TL755 or TL750, 11 or 12 = TL462, 15 = TL460, 43 = TLBK43LC, 57 = TLBK57GC, 58 = all Topaz "SE" models. The simulator reports 58. |
ClearTablet() |
clearTablet |
Clears the ink from the signature object. To clear the ink from the LCD, use LCDRefresh. |
ClearSigWindow(inside) |
clearSignatureWindow |
0 erases the signature data inside the signature window, 1 erases the data outside it (the hot spot buffer). |
NumberOfTabletPoints() |
numberOfTabletPoints |
Returns the number of points in the current signature (0 when nothing is signed). |
SetSigWindow(coords, x, y, width, height) |
setSignatureWindow |
Restricts the signature data to a window. coords: 0 = logical tablet coordinates, 1 = LCD coordinates. |
SetLCDCaptureMode(mode) |
setLCDCaptureMode |
0 = no LCD commands, 1 = capture with auto erase, 2 = persistent ink without auto erase, 3 = inverted ink on a dark background. |
LCDSetWindow(x, y, width, height) |
lcdSetWindow |
Restricts the ink shown on the LCD to the given window (LCD coordinates). |
LCDRefresh(mode, x, y, width, height) |
lcdRefresh |
Refreshes an LCD area. mode: 0 = clear, 1 = complement, 2 = write opaque (copy the background memory to the display), 3 = write transparent. |
LCDWriteString(dest, mode, x, y, font, text) |
lcdWriteString |
Writes text to the LCD. dest: 0 = foreground, 1 = background memory. mode as in LCDRefresh. font is a string such as "Arial, size=11, bold". |
KeyPadAddHotSpot(keyCode, coords, x, y, width, height) |
keypadAddHotSpot |
Defines a hot spot (a pad "button") that detects pen taps. coords: 0 = logical tablet coordinates, 1 = LCD coordinates. |
KeyPadQueryHotSpot(keyCode) |
keypadQueryHotSpot |
Returns a value greater than 0 if the hot spot was tapped. |
KeyPadClearHotSpotList() |
keypadClearHotSpotList |
Removes all hot spots. |
SetImageFileFormat(format) |
setImageFileFormat |
The format of the image returned by GetSignatureImage: 0 = compressed BMP, 1 = uncompressed BMP, 2 = monochrome BMP. Any other value (the default) returns a PNG image. |
SetImageXSize(width), SetImageYSize(height) |
setImageXSize, setImageYSize |
The size of the image in pixels. |
SetImagePenWidth(pixels) |
setImagePenWidth |
The pen width used to draw the image. |
SetJustifyMode(mode) |
setJustifyMode |
How the signature is placed in the image: 0 = no justification, 1-4 = justify and zoom to a corner, 5 = justify and zoom to the center. |
SetJustifyX(pixels), SetJustifyY(pixels) |
setJustifyX, setJustifyY |
The margins kept by the justification. |
GetSignatureImage(imgFormat, pixelFormat) |
getSignatureImage |
Returns the signature image as a MEMPTR. The format is set by SetImageFileFormat; the two arguments (for example "bmp", "Format1bppIndexed") are accepted for compatibility only. It replaces the .NET GetSigImage(), which returns a System.Drawing.Image. |
SetTranslateBitmapEnable(enable) |
setTranslateBitmapEnable |
Accepted, but has no effect. |
Enabling Conversion from .NET.¶
FWD does not convert the Topaz .NET SDK classes automatically: there is no conversion rule for Topaz.SigPlusNET. Because the 4GL methods of the signature widget have the same names and arguments as the .NET SDK, the 4GL source is changed before conversion as follows:
- Replace the
Topaz.SigPlusNETobject reference with a widgetHANDLE, and theNEW Topaz.SigPlusNET()(and the code that adds the .NET control to a form) withCREATE SIGNATUREin a 4GL frame. - Keep the method calls (
SetTabletState,LCDWriteString,KeyPadQueryHotSpotand so on) unchanged, on the new handle. - Replace the .NET event subscriptions (pen down / pen up) with
ON "PEN-DOWN"/ON "PEN-UP"triggers. - Replace
GetSigImage()and theSystem.Drawing.Imagehandling withGetSignatureImage, which returns aMEMPTRthat can be written withCOPY-LOB.
See the ".NET Example" below.
Runtime¶
How it Works¶
The 4GL code runs on the FWD server; the signature pad is attached to the PC that runs the browser. A call travels this way:
4GL code (FWD server) -> SignatureWidget: each method is sent to the client as a widget command -> FWD web client: SignatureDriverWidget -> browser: p2j.signature.html + SigWebTablet.js (Topaz Web SDK), shown inside the widget area -> SigWeb service on https://tablet.sigwebtablet.com:47290/SigWeb/ (on the browser PC) -> USB signature pad
- When the widget is placed, the web client serves the widget page under
<webRoot>/signature/<widget-id>/p2j.signature.htmland shows it in the widget area. The page loadsSigWebTablet.js, the unmodified Topaz SigWeb library. - Each 4GL method call is a synchronous widget command: the server waits for the browser to call the SigWeb function and returns its result to the 4GL code.
SigWebTablet.jsreaches the SigWeb service through the host nametablet.sigwebtablet.com, which resolves to127.0.0.1. Because the FWD web client is served over HTTPS, the HTTPS port 47290 is used (47289 is the plain HTTP port).- After
SetTabletState(1), the page draws the ink on the widget canvas and polls the SigWeb pen state every 200 ms. A change of the pen state raises thePEN-DOWNorPEN-UPevent in the FWD client, which runs the 4GL trigger. GetSignatureImageasks SigWeb for the image as a base64 PNG (GetSigImageB64). IfSetImageFileFormatselected a BMP format, the client converts the image to BMP before it is returned to the 4GL code.- In simulation mode (see "Signature Pad Simulator" below), the FWD server runs its own SigWeb service on port 47290 instead of the Topaz one. The widget page is then loaded with
?simMode: the mouse acts as the pen and the canvas shows the simulated LCD.
Setup of Browser-Based Signature Devices¶
To use a real Topaz signature pad:
- Use Windows on the PC that runs the browser, and attach the pad to that PC (USB). SigWeb supports Firefox, Chrome, Edge and Opera on Windows 8 and later. It cannot be used in remote environments such as Citrix XenApp, because the pad must be local to the browser.
- Install the Topaz SigWeb service on that PC from the SigWeb page. The installer adds the SigWeb service and the TLS certificate it uses on port 47290.
- Check that the service answers: open
https://tablet.sigwebtablet.com:47290/SigWeb/TabletStatein the browser. It must answer without a certificate warning. - Do not enable the signature pad simulator on a FWD server that runs on the same PC: the simulator also listens on port 47290.
If the SigWeb service is not reachable, the widget page logs the failed requests in the browser console and the signature method calls do not return pad data.
Configuration in FWD¶
No directory configuration is needed to use a real signature pad: the widget works in any Web GUI client.
The signature pad simulator is configured in the server-level webClient node of directory.xml (/server/default/webClient, or /server/<serverID>/webClient, which takes precedence):
| Directory node | Type | Default | Purpose |
|---|---|---|---|
signaturePadInSimMode |
boolean | FALSE |
Starts the signature pad simulator with the FWD server. For development and testing only. |
signaturePadAllowedOrigins |
string | (empty) | Additional browser origins allowed to call the simulator (comma-separated). |
signaturePadBindAddress |
string | 127.0.0.1 |
The local address the simulator listens on. |
The details are in the next section.
Signature Pad Simulator¶
The signature pad simulator (#11409) lets you use the SIGNATURE widget of the Web GUI client without a physical Topaz signature pad and without the Topaz SigWeb service. The FWD server runs an embedded HTTPS service that speaks the SigWeb protocol at https://tablet.sigwebtablet.com:47290/SigWeb/, and the user signs with the mouse on the widget canvas.
The simulator is for development and testing only. Do not enable it in production.
Prerequisites¶
- FWD trunk rev 16820 or later, with the jars rebuilt (
./gradlew allJars) and deployed to the application project (for exampleant deploy.preparein the converted project). - A converted application that uses the Web GUI client and has a SIGNATURE widget.
- The browser runs on the same host as the FWD server. The browser resolves
tablet.sigwebtablet.comon its own machine, so the simulator must be reachable on that machine's loopback address. For containers, see "Docker / published port" below. - Port 47290 is free on the server host: no Topaz SigWeb service and no other FWD server with the simulator enabled may run on this host.
Step 1: enable simulation mode in the directory¶
Add the boolean signaturePadInSimMode to the server-level webClient node of directory.xml: /server/default/webClient, or /server/<serverID>/webClient, which takes precedence (the node that holds virtualDesktop, embedded, portsRange and so on). This is how it looks in the testcases project (deploy/server/directory.xml):
<node class="container" name="server">
<node class="container" name="default">
...
<node class="container" name="webClient">
...
<node class="boolean" name="virtualDesktop">
<node-attribute name="value" value="TRUE"/>
</node>
<node class="boolean" name="embedded">
<node-attribute name="value" value="TRUE"/>
</node>
<node class="boolean" name="signaturePadInSimMode">
<node-attribute name="value" value="TRUE"/>
</node>
...
</node>
</node>
</node>
Notes:
- The flag is read once at server bootstrap. Restart the FWD server after you change it.
- It is a server-level setting. A project-specific value (
webClient/signaturePadInSimMode.<project>) is ignored, and a warning is logged when it differs. - Clients receive the flag from the server and cannot override it with
cfgOverrides. - The boolean node replaces the earlier
cfgOverridesrecipe from #11409-116 (client:web:signaturePadInSimMode=true). That recipe no longer works: it does not start the simulator, and the server value overrides it on the client. Remove it and set the directory node instead.
Step 2: make tablet.sigwebtablet.com resolve to the loopback address¶
Public DNS already resolves tablet.sigwebtablet.com to 127.0.0.1. Check it on the browser host:
getent hosts tablet.sigwebtablet.com
If it doesn't resolve (offline machine, filtering DNS), add a hosts entry on the browser host:
- Linux / macOS:
/etc/hosts - Windows:
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 tablet.sigwebtablet.com
Step 3: make the browser accept the simulator certificate¶
The simulator presents the FWD server's own TLS certificate (the web key store if valid, otherwise the server key store). The SigWeb calls are XHRs, so the browser cannot show a "proceed anyway" page for them. Without one of the options below, the widget page fails with net::ERR_CERT_AUTHORITY_INVALID or net::ERR_CERT_COMMON_NAME_INVALID in the browser console.
When the simulator starts and the certificate's SAN does not list tablet.sigwebtablet.com, the server log contains the warning Signature Simulator certificate does not cover tablet.sigwebtablet.com ....
Option A: quick fix for development (per browser session)¶
- Start the FWD server (Step 4).
- In the same browser profile that you use for the web client, open
https://tablet.sigwebtablet.com:47290/SigWeb/TabletState. - Accept the certificate warning (Chrome: Advanced → Proceed to tablet.sigwebtablet.com (unsafe)). The response body does not matter: what matters is that the browser has stored the exception.
- Reload the web client page that contains the signature widget.
The exception covers both the untrusted issuer and the name mismatch, but only for that host. Chrome forgets it after a restart or when the certificate changes, so repeat the steps when needed. An exception accepted for the FWD web client host (for example localhost:7449) does not cover tablet.sigwebtablet.com.
Option B: lasting fix¶
Both of the following steps are needed:
- Use a server certificate whose Subject Alternative Name contains
tablet.sigwebtablet.comin addition to the web client host name (for exampleDNS:localhost, DNS:tablet.sigwebtablet.com). FWD'sgencert.sh/SSLCertGenUtilcurrently writes only one SAN name. Multi-name support is tracked in #11987; until then, such a certificate has to be produced manually (for example with openssl, signed by the project root CA) and imported into the key store. - Trust the issuing root CA in the browser (import the root, not the server certificate):
- Chrome on Linux:
chrome://settings/certificates→ Authorities → Import → tick "Trust this certificate for identifying websites", or use thecertutilcommand below. - Firefox: Settings → Privacy & Security → Certificates → View Certificates → Authorities → Import.
- Windows / Chrome / Edge: import the root CA into "Trusted Root Certification Authorities".
- Chrome on Linux:
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n project-root -i root_ca.pem
Restart the browser after you import the root CA.
To check what the running simulator serves:
openssl s_client -connect 127.0.0.1:47290 -servername tablet.sigwebtablet.com </dev/null \ | openssl x509 -noout -subject -issuer -ext subjectAltName -dates
Step 4: start the server and check the log¶
Start the FWD server as usual. When simulation mode is on, the server log contains:
Signature Simulator started. Listening on 127.0.0.1:47290 for https://tablet.sigwebtablet.com:47290/SigWeb/
To check that the simulator is up without a browser, run this on the server host (a GET without an Origin header is allowed):
curl -k https://127.0.0.1:47290/SigWeb/TabletState
If the simulator cannot start, the server keeps running without it and logs one of these warnings:
| Log message | Cause / action |
|---|---|
| Signature Simulator not started: cannot listen on ...:47290 | Port 47290 is already in use (a Topaz SigWeb service, or another FWD server running the simulator), or signaturePadBindAddress is not an address of this host. Stop the other process or fix the address. |
| Signature Simulator not started: the bind address ... cannot be resolved | Fix webClient/signaturePadBindAddress. |
| Signature Simulator certificate does not cover tablet.sigwebtablet.com | The simulator runs, but browsers will reject it. See Step 3. |
Step 5: use the simulator¶
- Log in to the Web GUI client from a browser on the server host.
- Run a program that shows a SIGNATURE widget. The widget page loads as
p2j.signature.html?simMode. - Sign on the widget canvas with the left (primary) mouse button: press, drag and release. Moving the pointer off the canvas while you hold the button lifts the pen, as on a real pad. Other mouse buttons are ignored.
- The canvas shows the simulated LCD, at the size of the widget (LCD coordinates are widget pixels). In capture mode 1 (auto erase, the page default) the ink trace disappears about 4 seconds after the pen is lifted, as on a real pad. In capture mode 2 the ink stays.
- The 4GL program receives the usual signature events (
PEN-DOWNandPEN-UP) and the captured signature data, exactly as with a real device.TabletModelNumber()returns 58.
Optional configuration¶
All items belong to the same server-level webClient node.
| Directory node | Type | Default | When to use |
|---|---|---|---|
signaturePadAllowedOrigins |
string | (empty) | The widget page is served under an origin the server cannot learn at spawn time, for example a reverse proxy configured only through X-Forwarded-Host. Comma-separated list such as https://proxy.example.com, https://myhost:8443. |
signaturePadBindAddress |
string | 127.0.0.1 |
Browsers reach the simulator through another local interface, for example a published container port. |
<node class="string" name="signaturePadAllowedOrigins"> <node-attribute name="value" value="https://proxy.example.com"/> </node> <node class="string" name="signaturePadBindAddress"> <node-attribute name="value" value="0.0.0.0"/> </node>
Reverse proxy¶
Spawned web clients register their own origins with the simulator automatically. Behind a reverse proxy, the server trusts only the configured webClient/portsRange/forwardedHost (and forwardedProto), never the X-Forwarded-* request headers. If the proxy is not configured there, the server logs a warning, and you have to add the proxy origin to signaturePadAllowedOrigins.
Docker / published port¶
When the FWD server runs in a container, set signaturePadBindAddress to an address inside the container (for example 0.0.0.0), publish port 47290 to the host loopback only (-p 127.0.0.1:47290:47290), and run the browser on the Docker host. With a non-loopback bind address, the Origin check is the only guard against other clients, and a non-browser client can forge that header.
Troubleshooting¶
| Symptom (browser console / server log) | Cause | Fix |
|---|---|---|
net::ERR_CERT_AUTHORITY_INVALID on tablet.sigwebtablet.com:47290 |
The certificate issuer is not trusted by the browser. | Step 3, option A or B. |
net::ERR_CERT_COMMON_NAME_INVALID |
The certificate SAN does not list tablet.sigwebtablet.com. |
Step 3, option A, or a certificate with the extra SAN name. |
net::ERR_NAME_NOT_RESOLVED |
tablet.sigwebtablet.com does not resolve. |
Step 2. |
net::ERR_CONNECTION_REFUSED |
The simulator is not running, or the browser is on another host. | Check the server log (Step 4) and signaturePadInSimMode. Run the browser on the server host. |
HTTP 403 / CORS error on SigWeb requests; server log: Rejected SigWeb request from origin ...; add it to webClient/signaturePadAllowedOrigins ... |
The page origin is not allowed (unknown proxy origin, another FWD server owns port 47290, or the origin was evicted after more than 1024 spawns). The warning names the rejected origin. | Configure forwardedHost or add the named origin to signaturePadAllowedOrigins. Log in again if the origin was evicted. |
Simulator does not start although cfgOverrides contains client:web:signaturePadInSimMode=true |
The old cfgOverrides recipe (#11409-116) is no longer supported. The flag is read only from the server-level directory node. |
Remove the override and set signaturePadInSimMode as in Step 1, then restart the server. |
| Widget does not react to the mouse | The page is not in simulation mode (the URL has no ?simMode). |
Check that signaturePadInSimMode is set at server level and that the server was restarted. |
Limitations¶
- One simulated pad per FWD server, shared by all its web clients. Only one FWD server per host can run the simulator, because port 47290 is fixed.
- The browser must run on the FWD server host (or reach the simulator through
signaturePadBindAddress). - The simulator uses the FWD server certificate. Multi-name certificate support is tracked in #11987.
Examples¶
.NET Example¶
The typical shape of 4GL code that uses the Topaz .NET SDK, and the same logic after it is moved to the signature widget.
Before (.NET SDK):
DEFINE VARIABLE oSigPlus AS Topaz.SigPlusNET NO-UNDO.
DEFINE VARIABLE oImage AS System.Drawing.Image NO-UNDO.
oSigPlus = NEW Topaz.SigPlusNET().
/* ... the control is added to a .NET form ... */
oSigPlus:PenUp:Subscribe("onPenUp").
oSigPlus:SetTabletState(1).
oSigPlus:ClearTablet().
...
IF oSigPlus:NumberOfTabletPoints() > 0 THEN
DO:
oSigPlus:SetImageXSize(571).
oSigPlus:SetImageYSize(200).
oSigPlus:SetJustifyMode(5).
oImage = oSigPlus:GetSigImage().
oImage:Save("signature.bmp", System.Drawing.Imaging.ImageFormat:Bmp).
END.
oSigPlus:SetTabletState(0).
After (signature widget):
DEFINE VARIABLE hSig AS HANDLE NO-UNDO.
DEFINE VARIABLE mImg AS MEMPTR NO-UNDO.
CREATE SIGNATURE hSig
ASSIGN FRAME = FRAME fMain:HANDLE
X = 12
Y = 96
WIDTH-PIXELS = 400
HEIGHT-PIXELS = 300
SENSITIVE = TRUE
VISIBLE = TRUE.
ON "PEN-UP" OF hSig
RUN onPenUp.
hSig:SetTabletState(1).
hSig:ClearTablet().
...
IF hSig:NumberOfTabletPoints() > 0 THEN
DO:
hSig:SetImageFileFormat(2).
hSig:SetImageXSize(571).
hSig:SetImageYSize(200).
hSig:SetJustifyMode(5).
mImg = hSig:GetSignatureImage("bmp", "Format1bppIndexed").
COPY-LOB FROM mImg TO FILE "signature.bmp" NO-CONVERT.
SET-SIZE(mImg) = 0.
END.
hSig:SetTabletState(0).
"Pure" 4GL Widget Usage Example¶
A minimal program: the user signs on the pad, and the Accept button saves the signature as a monochrome BMP. The file is written by the converted code, so it is created on the FWD server.
DEFINE VARIABLE hSig AS HANDLE NO-UNDO.
DEFINE VARIABLE mImg AS MEMPTR NO-UNDO.
DEFINE VARIABLE cFile AS CHARACTER NO-UNDO.
DEFINE BUTTON btnStart LABEL "Start" SIZE-PIXELS 80 BY 26.
DEFINE BUTTON btnClear LABEL "Clear" SIZE-PIXELS 80 BY 26.
DEFINE BUTTON btnAccept LABEL "Accept" SIZE-PIXELS 80 BY 26.
DEFINE FRAME fMain
btnStart AT X 10 Y 320
btnClear AT X 100 Y 320
btnAccept AT X 190 Y 320
WITH SIZE-PIXELS 420 BY 360 THREE-D NO-BOX.
/* the window must hold the frame, or the widget extends past its right edge */
ASSIGN
CURRENT-WINDOW:TITLE = "Signature"
CURRENT-WINDOW:WIDTH-PIXELS = 420
CURRENT-WINDOW:HEIGHT-PIXELS = 360.
CREATE SIGNATURE hSig
ASSIGN FRAME = FRAME fMain:HANDLE
X = 10
Y = 10
WIDTH-PIXELS = 400
HEIGHT-PIXELS = 300
SENSITIVE = TRUE
VISIBLE = TRUE.
ON "PEN-UP" OF hSig DO:
MESSAGE STRING(hSig:NumberOfTabletPoints()) "points captured".
END.
ON CHOOSE OF btnStart IN FRAME fMain DO:
hSig:SetTabletState(1).
hSig:ClearTablet().
/* persistent ink on the LCD */
hSig:SetLCDCaptureMode(2).
END.
ON CHOOSE OF btnClear IN FRAME fMain DO:
hSig:ClearTablet().
/* mode 0: clear the LCD */
hSig:LCDRefresh(0, 0, 0, 400, 300).
END.
ON CHOOSE OF btnAccept IN FRAME fMain DO:
IF hSig:NumberOfTabletPoints() = 0 THEN
DO:
MESSAGE "Please sign first." VIEW-AS ALERT-BOX.
RETURN NO-APPLY.
END.
/* monochrome BMP, 571 x 200, centered and zoomed */
hSig:SetImageFileFormat(2).
hSig:SetImageXSize(571).
hSig:SetImageYSize(200).
hSig:SetImagePenWidth(11).
hSig:SetJustifyMode(5).
mImg = hSig:GetSignatureImage("bmp", "Format1bppIndexed").
cFile = SESSION:TEMP-DIRECTORY + "signature.bmp".
COPY-LOB FROM mImg TO FILE cFile NO-CONVERT.
SET-SIZE(mImg) = 0.
hSig:SetTabletState(0).
MESSAGE "Signature saved to" cFile VIEW-AS ALERT-BOX.
END.
ENABLE btnStart btnClear btnAccept WITH FRAME fMain.
WAIT-FOR CLOSE OF CURRENT-WINDOW.
A complete example that draws its own screens on the pad LCD (LCDWriteString), uses pad buttons (KeyPadAddHotSpot / KeyPadQueryHotSpot) and works with both a real pad and the simulator is abl/signature/signature_demo.p in the testcases project.
© 2019-2026 Golden Code Development Corporation. ALL RIGHTS RESERVED.
