Module dbExtFrm.pkg
************************************************************************
Confidential Trade Secret.
Copyright (c) 1997 Data Access Corporation, Miami Florida
as an unpublished work. All rights reserved.
DataFlex is a registered trademark of Data Access Corporation.
************************************************************************
************************************************************************
$File name : dbExtFrm.pkg
$File title : dbFormExternalControl
Notice :
$Author(s) : John Tuohy
$Rev History
9/8/97 JJT - File created
************************************************************************
This creates an class that can be used for creating single item data-entry
classes based around a custom windows control(or any DLL). This class is used
for sub-classing only. This contains all the "basic" behaviors required
to create a DEO class. In a sub-class you must add the needed logic to
talk to a custom control and the needed logic to coordinate the DF class and
the windows control. Normally this is done as follows:
1. Create a mixin class that contains all of the logic and interface to
support a custom control. Normally, this class will define an external
control (Set External_Class_Name 'DFTrackBar' To "msctls_trackbar32")
and map windows messages to DF messages (Set External_Message WM_HSCROLL
To Private_SliderNotification). Normally this mixin class will itself
contain a mixin class named External_Class_Mixin (DFExtClM.pkg) which
contains logic that will be common to all external control mixin classes.
In particular this creates two messages External_SetFocus and
External_KillFocus were created to handle focus changes events. Those
messages must be mapped to windows messages and will most likely be:
Set External_Message WM_SETFOCUS To External_SetFocus
Set External_Message WM_KILLFOCUS To External_KillFocus
2. When creating this mixin class you need to identify three message types:
A. The message(s) that is (are) sent when the control's data value is
changed. Whenever the windows control changes we want to notify the DF
side of this change so that Get Value is always up to date. This is very
important for DDs since they must be updated anytime a DEO's data value
changes. We will augment each of these messages and force it to send
the message ControlValueChanged. This will force the DF side to stay
synchronized with the control.
B. The message that gets the current data value of the windows control. This
is used to get this value and set the DF side's value accordingly.
C. The message that sets the current data value of the windows control. This is
used to set the control value to its DF value. Often B and C will be a
GET/SET message of the same name.
For the sake of example lets assume that messages A, B, and C were defined in
the mixin as:
A. Procedure onHeyControlChanged
B. Function MyCustomControlDataValue returns String
C. Procedure Set MyCustomControlDataVale String sVal
3. You will create your sub-class as follows:
Class dbMyCustomFormClass is a dbFormExternalControl
import_class_protocol MyCustomControl_Mixin
Procedure Construct_Object
Forward Send Construct_Object
Send Define_MyCustomControl_Mixin
End_Procedure // Construct_Object
// we must identify all events that result in a changed
// value in the control and notify the DF side about this
// change. We notify DF by sending ControlValueChanged. If multiple
// events cause changes, multiple messages must be created all sending
// ControlValueChanged
Procedure OnHeyControlChanged
Send ControlValueChanged
End_Procedure
// The class expects a message named Set ControlValue. It is passed a string
// and should be used to change the value of the windows control. This
// is the message "C" from above.
Procedure Set ControlValue string sVal
Set MyCustomControlDataValue to sVal
End_Procedure
// The class expects a messsage named get controlValue. It will return
// the control's data value.
Function ControlValue Returns String
string sVal
Get MyCustomControlDataValue to sVal
Function_return sVal
End_Function
End_Class
dbExtFrm.pkg (view source)- import declarations
- dbFormExternalControl : dbForm
- Construct_Object()
- integerPrivate.ControlChangingState
This is used to prevent recursion. When a control notifies
DF that a value has changed, DF will attempt to notify the
control. We must stop that circularity
- integerLocalChangingState
set true when making a local (externally triggered) change. This is
set when a Set Value of Set Local_Value change is made
- set(integer iItem string sVal)
When the DF side changes we must notify the control about the change.
If DD are in use we must use set Local_Value, if no DD we use set value
- set(integer iItem string sVal)
- Set(string sVal)
It is expected that the sub-class (or more likely another
mixin included with the sub-class will provide functionality
for these messages. This gets and sets the value of the actual
window control. These should only be used to synchronize the window
control and the DF side. Do not use for any other purpose.
- StringControlValue()
- RefreshControl(string sVal)
refresh control without triggering a DD changed condition.
- IntegerbOld
- ControlValueChanged()
- IntegerbOld
- Stringsval
References (1):
Field References (0):
Module | Containing Symbol | Line |
---|