|
key
|
|
Full name
|
pfc_u_calculator.dw_calculator.key
|
Access
|
public
|
Extend of
|
|
Return value
|
|
Prototype
|
event key(keycode,unsignedlong)
|
Name
|
Datatype
|
ls_buttontext
|
String
|
event key;call super::key;//////////////////////////////////////////////////////////////////////////////
//
// Event: key
//
// Arguments:
// key
// keyflags
//
// Returns: None
//
// Description:
// Provide KeyBoard support.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
String ls_buttontext
// Look out for the Escape and the Tab keys.
Choose Case key
Case KeyEscape!
//If appropriate, hide the Calendar.
If IsValid(inv_dropdown) Then
If ib_closeonclick Then
// Set focus on the Requestor object which in turns hides the calendar.
of_SetFocusOnRequestor()
End If
End If
Return
Case KeyTab!
If IsValid(inv_dropdown) Then
Post of_SetFocusOnRequestor()
End If
Return
End Choose
// Determine what action to take.
If KeyDown(KeyDecimal!) or (Not KeyDown(KeyShift!) And KeyDown(KeyPeriod!)) Then
ls_buttontext = '.'
ElseIf KeyDown(KeyNumpad0!) or (Not KeyDown(KeyShift!) And KeyDown(Key0!)) Then
ls_buttontext = '0'
ElseIf KeyDown(KeyNumpad1!) or (Not KeyDown(KeyShift!) And KeyDown(Key1!)) Then
ls_buttontext = '1'
ElseIf KeyDown(KeyNumpad2!) or (Not KeyDown(KeyShift!) And KeyDown(Key2!)) Then
ls_buttontext = '2'
ElseIf KeyDown(KeyNumpad3!) or (Not KeyDown(KeyShift!) And KeyDown(Key3!)) Then
ls_buttontext = '3'
ElseIf KeyDown(KeyNumpad4!) or (Not KeyDown(KeyShift!) And KeyDown(Key4!)) Then
ls_buttontext = '4'
ElseIf KeyDown(KeyNumpad5!) or (Not KeyDown(KeyShift!) And KeyDown(Key5!)) Then
ls_buttontext = '5'
ElseIf KeyDown(KeyNumpad6!) or (Not KeyDown(KeyShift!) And KeyDown(Key6!)) Then
ls_buttontext = '6'
ElseIf KeyDown(KeyNumpad7!) or (Not KeyDown(KeyShift!) And KeyDown(Key7!)) Then
ls_buttontext = '7'
ElseIf KeyDown(KeyNumpad8!) or (Not KeyDown(KeyShift!) And KeyDown(Key8!)) Then
ls_buttontext = '8'
ElseIf KeyDown(KeyNumpad9!) or (Not KeyDown(KeyShift!) And KeyDown(Key9!)) Then
ls_buttontext = '9'
ElseIf KeyDown(KeyAdd!) or (KeyDown(KeyShift!) And KeyDown(KeyEqual!)) Then
ls_buttontext = '+'
ElseIf KeyDown(KeySubtract!) or (Not KeyDown(KeyShift!) And KeyDown(KeyDash!)) Then
ls_buttontext = '-'
ElseIf KeyDown(KeyMultiply!) or (KeyDown(KeyShift!) And KeyDown(Key8!)) Then
ls_buttontext = '*'
ElseIf KeyDown(KeyDivide!) or (Not KeyDown(KeyShift!) And KeyDown(KeySlash!)) Then
ls_buttontext = '/'
ElseIf KeyDown(KeyEnter!) or (Not KeyDown(KeyShift!) And KeyDown(KeyEqual!)) Then
ls_buttontext = '='
Else
// Not a key on which action is needed.
Return
End IF
// Tell the object of the clicked button.
If Len(ls_buttontext) > 0 Then
of_ButtonClicked (ls_buttontext)
End If
// Determine if the Main object should go away.
If ls_buttontext = '=' Then
If IsValid(inv_dropdown) And ib_closeonclick Then
of_SetFocusOnRequestor()
Return
End If
End If
Return
end event