Module Dfextclm.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 : dfExtClM.pkg
$File title : external class mixin support
Notice :
$Author(s) : John Tuohy
$Rev History
JJT 9/8/97 Revised
JJT 7/25/97 File Created
************************************************************************
This provides common mixin messages for hooking an external class
to a VDF class. This assumes that this external class will be mixed into
The main goal of this mixin is to sychronize the DataFlex focus event
with the windows focus event.
If is very important that a tool maker watches the focus change mechanism.
It is very easy to create a control that looks like it is working but is
An object takes the focus one of two ways: Either DataFlex gives it the
focus (keyboard or send activate) or Windows gives it the focus (mouse).
All of the internal DF classes makes sure that these two types of events
are synchronized. When using external controls you must make sure that this
is the case. Note that:
1. When DF sends activate to an object it may not give it the windows
focus. This one can usually be seen by testing with keyboard navigation.
Currently, we are augmenting Set Focus to make this work right.
2. When Windows gives the object the focus it may not tell DF about it.
You can not see this problem but you can test by getting the focus
property. If the focus is a different object than the object that
appears to have the focus, windows has given the object the focus
without telling DF. We use External_SetFocus (which is a notification
of a windows event) to check for this.
3. You want to make sure that DF sends the same focus change events when
an external object gets the focus or when it loses it. In particular,
you want to make sure that Notify_Focus_Change is sent to both objects
passing the appropriate Fg. This is very important. It insures that
OnSetFocus and onKillFocus are sent along with a number of other messages
which maintain status-help and default action buttons. This requires
careful checking to see what is sent and what is not and this must be
tested with both keyboard (DF side) and mouse (windows side) navigation.
Set Focus, External_SetFocus and External_KillFocus all had to be
messed with to get this right.
Currently,
1. When the windows side takes the focus the DF side is not notified.
To make this work we sit on this message and send activate to the
DF side. We also need to send Notify_focus_Change (same needed
on a killFocus) because this is not getting sent.
2. There is a bug in the external class mechanism when used with
form objects. The DF Set_Focus message gets canceled. So we force
this through by sending a windows SetFocus. (This could change in
the future which could also affect #1's need to send notify
messages).
3. We hook into Page_object to force it to send PreInitializeWindow,
initializeWindow (both whose functionality must be provided) and
Shadow_display. Normally InitializeWindow is required to move
DF properties into the newly created windows control. PreIntializeWindow
is needed when windows styles must be set before creating the control.
Shadow_Display sends Enable_Window which normally requires not
additional code. Enable_Window if provided to support shadowing of
objects.
NOTE: it is very important that developer uses object_Shadow_state
to disable entry to a window. If you can not enter the object it should
be shadowed (disabled). Using a non-zero return to disable entry to an
enabled windows should be avoided.
It is expected that the external control will want to hook into the
following messages already created in this class:
External_SetFocus : Most likey assigned to WM_SetFocus
External_KillFocus: Most likely assign to WM_KillFocus
expected usage:
Class MyFancyControl_Mixin is a Mixin
Import_Class_Protocol External_Class_Mixin
Procedure Define_MyFancyControl_Mixin
Set External_Class_Name '?????' To "?????"
Set External_Message ?????? To ?????
Set External_Message WM_SETFOCUS To External_SetFocus
Set External_Message WM_KILLFOCUS To External_KillFocus
:
end_procedure
:
Procedure PreInitializeWindow
: called before control has been paged
End_procedure
:
Procedure InitializeWindow
: called after control has been paged
End_procedure
End_Class
Class dbMyFancyControl is a dbFormExternalControl
Import_Class_Protocol MyFancy_control_Mixin
Procedure Construct_Object
forward send construct_object
Send Define_MyFancyControl_Mixin
:
end_procedure
:
end_Class
Dfextclm.pkg (view source)- import declarations
- External_Class_Mixin : Mixin
- External_SetFocus()
- IntegeriFail
- External_KillFocus()
- PreInitializeWindow()
Normally this is not used. This is called right before the
windows control is created. Can be used to set windows
styles.
- InitializeWindow()
Normally this will get replaced (not augmented) by a mixin at
the same level.
- Page_Object(Integer state)
- Integerwinhnd
- Enable_Window(integer iState)
This could be augmented to do whatever is required to make
this control enable
- IntegerhWnd
- Shadow_Display()
- set(integer h1 integer h2)
Currently form based classes cancel the set focus message if
there are no form_windows (which there will not be in an
external class). So we force windows to do the focus change. This
behavior may change in the future.
- Integerrval
References (1):
Field References (0):
Module | Containing Symbol | Line |
---|