Module Kbdfix.pkg
1//************************************************************************
2// KbdFix.pkg
3//
4// Copyright (c) 1997 Data Access Corporation, Miami Florida,
5// All rights reserved.
6// DataFlex is a registered trademark of Data Access Corporation.
7//
8//************************************************************************
9// Description:
10// Provides a fix for foreign kbds where the top number row is altered
11// (i.e. French numbers are shifted). This replaces logic found in the
12// C msg_key handler for dfForm and dfEntry. This will be removed when the
13// code is fixed in C.
14// rev 1.1
15//
16// Can be added to end of dfbase.pkg
17//
18// 11/23/98 JJT - use Current instead of 0 for item#. Fixes grid bug
19// 06/05/98 JJT - revsion 1.1 Fixed bug in Combos where up/dn arrows don't work
20// 04/05/98 JJT - Added Backspace support (from Frank VDV)
21// 03/27/98 JJT - created
22//************************************************************************
23
24// All of these methods
25// are fixes that will get moved to the runtime at some point and all their
26// detail is quite private.
27Use VdfBase.pkg
28
29// replace key procedure to properly check numeric keyboard values
30{ Visibility=Private NoDoc=True }
31procedure Private.Key for cUIObject integer iKy returns integer
32 integer iRet iCh iType iSep
33 // if up or down arrow, always pass it through. These can be generated
34 // by non key events and we want them to work. Fixes bug where sending
35 // up or down in grids might not work because the last key-pressed was
36 // something different and invalid
37
38 // if key is up-arrow, dn-arrow or a contrl key, let runtime handle it
39 // If not (iKy=kUparrow or iKy=kDownarrow) begin
40 If not (iKy=kUparrow or iKy=kDownarrow or (iKy iAND key_ctrl)) begin
41
42 Get Form_DataType item CURRENT to iType
43
44 // only special check non mask date and all numerics.
45 // for some reason mask numerics allow bad character to slip
46 // in. We can filter them here.
47 //If ( iType<=DATE_WINDOW or iType=MASK_CURRENCY_WINDOW or iType=MASK_NUMERIC_WINDOW) Begin
48 // we will pass through all strings and all masks. As of 8.2, masks will figure out if a character is valid
49
50 // We only need to test non-mask dates and windows.
51 If ( iType<=DATE_WINDOW) Begin
52
53 // convert to DF key. If ascii, ret ascii/Char value else ret DF key value
54 get dfkey iKy to iCh
55 // char is ok if between '0' and '9 or above 255 or a BS (8)
56 If ( (iCh<48 AND iCh <> 8) OR (iCh>57 AND iCh<=255)) Begin // Changed by FVDV for Backspace support
57 If iType EQ DATE_WINDOW Begin // date type
58 Get_Attribute DF_DATE_SEPARATOR to iSep //check for date separator
59 If iSep ne iCh Procedure_return 0
60 end
61 else Begin // numeric type. 32=" ", 45="-"
62 If (iCh<>32 AND iCh<>45) begin
63 Get_Attribute DF_DECIMAL_SEPARATOR to iSep
64 If iSep ne iCh Procedure_return 0
65 end
66 end
67 end
68 end
69 end
70 // this means the key is ok
71 Set Windows_override_state to false
72 Procedure_return 0
73End_Procedure
74
75// replace key procedure to properly check numeric keyboard values
76{ MethodType=Event NoDoc=True }
77procedure Key for dfBaseForm integer iKy returns integer
78 Send Private.Key iKy
79 If not (Windows_override_State(self)) forward send key iKy
80End_procedure
81
82{ MethodType=Event NoDoc=True }
83procedure Key for dfBaseEntry integer iKy returns integer
84 Send Private.Key iKy
85 If not (Windows_override_State(self)) forward send key iKy
86End_procedure
87
88{ MethodType=Event NoDoc=True }
89procedure Key for dfBaseFormList integer iKy returns integer
90 Send Private.Key iKy
91 If not (Windows_override_State(self)) forward send key iKy
92End_procedure
93
94{ MethodType=Event NoDoc=True }
95procedure Key for dfBaseEntryList integer iKy returns integer
96 Send Private.Key iKy
97 If not (Windows_override_State(self)) forward send key iKy
98End_procedure
99
100// Very Private:
101// This duplicates the C code for these two classes. We must expose these here because we replaced
102// these C level messages in BaseEntryList and BaseFormList. Once we do that, we need to crate flex
103// level messages for their C based sub-classes.
104// If entry_state is false, we just want to let windows windows handle all key behavior.
105
106// This one should not be needed, C code should do it. It does not forward to above augmentations
107//procedure key for dfBaseComboBox integer iKy returns integer
108// If ( (entry_state(self,0)=0) Or ;
109// iKy=KUPARROW or iKy=KDOWNARROW or iKy=KSCROLL_BACK or iKy=KSCROLL_FORWARD) ;
110// set windows_override_state to false
111// else ;
112// forward send key iKy
113//end_procedure
114
115{ MethodType=Event NoDoc=True }
116procedure Key for dfBaseComboBoxEntry integer iKy returns integer
117 If ( (entry_state(self,0)=0) Or ;
118 iKy=KUPARROW or iKy=KDOWNARROW or iKy=KSCROLL_BACK or iKy=KSCROLL_FORWARD) ;
119 set windows_override_state to false
120 else ;
121 forward send key iKy
122end_procedure
123
124
125