OnDeviceButton, OnDeviceButtonEx

Declaration

HRESULT OnDeviceButton([in] long ButtonEvent);

HRESULT OnDeviceButtonEx([in] long ButtonEvent, [in] long LParam);

Description

This event is fired when virtual LCD button is pressed.

Arguments

ButtonEvent

Return Value of OnDeviceButtonEx contains ButtonID and Mode.

ok = 13500416 -> 0x00CE0000 => Bit 31-16 : 00CE = Button 206, Bit 15-0 : 0000 = Pad Mode 0 (SignatureMode)

ButtonID ( more info)   

ButtoncodeDescription
simple dialog Pen up0
Simpledialog pen down1
HID_CMD_BUTTON_ZOOM_P200
HID_CMD_BUTTON_ZOOM_M201
HID_CMD_BUTTON_NEXT202
HID_CMD_BUTTON_PREV    203
HID_CMD_BUTTON_START_SIGN204
HID_CMD_BUTTON_ROTATE205obsolete
HID_CMD_BUTTON_ROTATE180205
HID_CMD_BUTTON_OK206
HID_CMD_BUTTON_REPEAT207
HID_CMD_BUTTON_CANCEL     208
HID_CMD_BUTTON_ROTATE90209Portrait / Landscape (only duraSign Pad 10.0 )
HID_CMD_BUTTON_JUMP_PAGE210Jumps to specified page number starting with 1 for the first page, only i/aStepOverCapture App
HID_BUTTON_PAD_REMOVED255virtual Button, the pad is removed
HID_BUTTON_SCRIPT_FINISHEDFFFFFFFFh (-1)dialog finished




Mode types

modecodedecription
DEFAULT_SIGN_MODE0default signature mode
DOCUMENT_VIEW_MODE5Document view mode
DOCUMENT_SIGN_MODE6sign in document mode

4sign with background image on bw

15continous scrolling document viewing mode
SIMPLE_DIALOG14 simple dialog mode

LParam

The meaning of LParam argument depends on ButtonEvent value.

ButtonEventLParam
HID_CMD_BUTTON_SCRIPT_FINISHEDLast dialog event.
HID_CMD_BUTTON_JUMP_PAGErequested pdf page number, starting with 1 for the first page, which should be sent to smartphone by LCDImageEx(R) with type 8 , x= requested page number and y = page count to smartphone
SimpleDialogHolds Pen pressed Cordinates X and Y
All other valuesUser-defined parameter, can be set by SetDriverLong, key=37.

Sample

C#
//  Event for Device Button Press
SigDev.OnDeviceButtonEx += new AxStepOverSignatureDevice1.IStepOverSignatureDeviceEvents_OnDeviceButtonExEventHandler(SigDev_OnDeviceButtonEx);
 
private void SigDev_OnDeviceButtonEx(object sender, AxStepOverSignatureDevice1.IStepOverSignatureDeviceEvents_OnDeviceButtonExEvent e)
{
      //  forward Event to SignAPI so it can react in DocView
      axSignAPIv4.OnDeviceLCDButtonHandler(e.buttonEvent);
      int ID = Convert.ToInt32(e.buttonEvent >> 16);
      int Mode = Convert.ToInt32(e.buttonEvent & 0xFFFF);
      
      // Check for ID    
      switch (ID)       
      {                
		case 206:	//  OK Button
                	break;
                
		case 207:	//  Repeat Button
					break;
                
		case 208:	//  Abort Button
                    break;       
	  }
}
 
Delphi
const WM_PADBUTTON_PRESS      = WM_USER + $0012;

type
  TMainForm = class(TForm)
		...
		StepOverSignatureDevice1: TStepOverSignatureDevice;
		...
		procedure StepOverSignatureDevice1DeviceButtonEx(Sender: TObject;  ButtonEvent, LParam: Integer);
	private:
		procedure OnPadButtonPress(var Msg: TMessage);                  message WM_PADBUTTON_PRESS;
	...
end;

procedure TEsoMainForm.StepOverSignatureDevice1DeviceButtonEx(Sender: TObject; ButtonEvent, LParam: Integer);
begin
    // do not block this message !, we send ourself a new message
    PostMessage(Handle, WM_PADBUTTON_PRESS, ButtonEvent, LParam);
end;

procedure TEsoMainForm.OnPadButtonPress(var Msg: TMessage);
var
    padmode     : Integer;
    buttoncode  : Integer;
    ButtonEvent : Cardinal;
begin
    ButtonEvent := Msg.WParam;

    buttoncode  := (Cardinal(ButtonEvent) shr 16) and $0000FFFF;
    padmode     :=  Cardinal(ButtonEvent)         and $0000FFFF;

    // Check for ID    
    case ID of       
        206: begin	//  OK Button
             end;
                
		207: begin	//  Repeat Button
			 end;
                
		208: begin  //  Abort Button
             end;       
	 end;
end;
VB.Net
AddHandler SignatureDevice.OnDeviceButtonEx, AddressOf OnDeviceButtonExEventHandler
 
Private Sub OnDeviceButtonExEventHandler(sender As Object, e As IStepOverSignatureAPIv4Events)

        'Forward Event to SignAPI so it can response in DocView Mode
        SignatureAPIv41.OnDeviceLCDButtonHandler(e.buttonEvent)
        Dim ID As Integer = Convert.ToInt32(e.buttonEvent >> 16)
        Dim Mode As Integer = Convert.ToInt32(e.buttonEvent << 16)

        'Check buttonID
        Select Case ID

            Case 204

                'Repeat Button

                Dim BCtrlDelegate As BtnCtrlDelegate = AddressOf ButtonControl

                Me.Invoke(BCtrlDelegate, New Object() {False})

            Case 206
                'OK Button, you can confirm Signature

                If (SignatureAPIv41.GetLoadedDocName() = "" Or SignatureAPIv41.GetLoadedDocName() = Nothing) Then

                    Dim BCtrlDelegate As BtnCtrlDelegate = AddressOf ButtonControl

                    Me.Invoke(BCtrlDelegate, New Object() {False})
                Else

                    Dim BCtrlDelegate As BtnCtrlDelegate = AddressOf ButtonControl

                    Me.Invoke(BCtrlDelegate, New Object() {True})

                End If

            Case 207
                ' OK Repeat, you can restart signing
                Dim BtnCtrlDelegate As BtnCtrlDelegate = AddressOf ButtonControl

                Me.Invoke(BtnCtrlDelegate, New Object() {True})

            Case 208
                ' Abort, you can abort signing

                Dim BCtrlDelegate As BtnCtrlDelegate = AddressOf ButtonControl

                Me.Invoke(BCtrlDelegate, New Object() {False})

        End Select
End Sub