Date
The Date control is used to assist entry of dates by providing a calendar browsing dialog box.
It
appears as an edit field with a button to the right that has a calendar page icon. If the button is
clicked or the F4 key is pressed, a dialog box appears so the user can select a date. The selected
date is displayed in the format chosen in the Windows Control Panel.
The keyboard interface for the calendar dialog box that comes up when the calendar button is
clicked is as follows:
Key |
Result |
Left |
Go back one day. |
Right |
Go forward one day. |
Up |
Go back one week. |
Down |
Go forward one week. |
PgUp |
Go back one month. |
PgDn |
Go forward one month. |
The mouse interface for the calendar dialog box is as follows:
Click |
Result |
@@ |
Go back one year |
!! |
Go forward one year. |
@ |
Go back one month. |
! |
Go forward one month. |
Date |
Select that date and dismiss the dialog box. |
Today |
Select today's date and dismiss the dialog box. |
The Date control is used like a normal edit control. It responds to most of the same messages
as
an edit control and sends notifications to its parent that are the same as those for an edit control.
When you specify dimensions for the control, the button will be placed inside the dimensions
you
give and the edit field portion of the control will fill the remainder of the area.
Working examples of the definition and use of the Date control are in the sample program.
See
Shared Code Sample Applications in the introductory section of this
manual.Class Name
WCWP_DATE
Styles
DATES_VALIDATE
When the focus is moved from the field, the string in the field will be checked to see if it is a
valid date string and will be reformatted to a standard display format.

Date Structures
WPDate
Contains the information used by the Date control.
Definition
typedef struct
{
WORD wYear;
BYTE bMonth;
BYTE bDay;
BYTE bHour;
BYTE bMinute;
BYTE bSecond;
BYTE bDayOfWeek;
BYTE bTimeZone;
BYTE bUnused;
} WPDATE, FAR* LPWPDATE;
Types
WPDATE
The WPDATE structure type.
LPWPDATE
A far pointer to a WPDATE structure.
Members
wYear
The current year.
bMonth
The current month.
bDay
The current day.
bHour
The current hour.
bMinute
The current minute.
bSecond
The current second.
bDayOfWeek
The current day of the week.
bTimeZone
The current time zone.
bUnused
Reserved.
The Date control works only with the first three items (wYear, bMonth, bDay).

Date Messages
DATE_GETDATE
Gets the date in binary format.
Members
wParam
0.
lParam
Pointer to WPDATE structure where the date (year, month, day) is to be placed.
Return Values
Returns zero if date is valid, 1 if not valid.
DATE_SETDATE
Sets date using binary format.
Members
wParam
0.
lParam
Pointer to WPDATE structure containing the date.
Additional Messages
The following standard Windows edit control messages are also supported by the Date
control.
EM_CANUNDO
EM_EMPTYUNDOBUFFER
EM_GETMODIFY
EM_GETSEL
EM_LIMITTEXT
EM_REPLACESEL
EM_SETMODIFY
EM_SETSEL
EM_UNDO
WM_ENABLE
WM_GETDLGCODE
WM_GETFONT
WM_GETTEXT
WM_GETTEXTLENGTH
WM_SETTEXT

Date Notification
WM_COMMAND
The WM_COMMAND message is sent from the control to its parent window whenever
certain
events occur.
Members
wParam
Contains the window ID of the Date control.
lParam
The LOWORD contains the handle to the window. The HIWORD contains one of the values in
the following table.
Value |
Definition |
EN_CHANGE | Same as the Windows edit control. |
EN_ERRSPACE | Same as the Windows edit control. |
EN_HSCROLL | Same as the Windows edit control. |
EN_MAXTEXT | Same as the Windows edit control. |
EN_SETFOCUS | Same as the Windows edit control. |
EN_UPDATE | Same as the Windows edit control. |
EN_KILLFOCUS | Same as the Windows edit
control. |

Drag/Drop Well
The Drag/Drop Well control looks like a recessed box with an icon in it. It handles the
WordPerfect drag/drop protocol on behalf of the parent of the control. The user presses and
holds the left mouse button to drag an object from this control to another window that can accept
the dragged object. The control may also be a destination, so an object can be dragged and
dropped onto this control.
Class Name
WCWP_DDWELL is the class name for the Drag/Drop Well control. The window text is the
name of the icon that will be displayed in the control.

Drag/Drop Well Structures
DDWDATA
The DDWDATA structure is maintained for each control and is used to pass messages from
the
control to its parent and to receive data back from the parent.
Definition
typedef struct
{
HWND hwnd;
UINT uiId;
DWORD dwRsvp;
HINSTANCE hInstIcon;
WORD idIcon;
HICON hIcon;
WORD wIndex;
LPDDROPOBJECT lpObject;
} DDWDATA, FAR* LPDDWDATA;
Types
DDWDATA
The DDWDATA structure.
LPDDWDATA
A long pointer to a DDWDATA structure.
Members
hwnd
Window handle of the drag/drop well control sending the message.
uiId
ID of the drag/drop well control sending the message.
dwRsvp
On a WPMSG_DD_RSVP message, this contains the response sent by the window that the
cursor is over.
hInstIcon
Instance handle for this icon. On the WPMSG_DD_ICONHINST message, the
hInstance of the
module containing the icon should be placed in this field. The hInstance can be the
actual
hInstance or WPRES_TASK, WPRES_SHARED_RESOURCE, and so forth.
idIcon
Identifier for icon (0 for named icon).
hIcon
Handle to the icon that is displayed for this control.
wIndex
Used on WPMSG_DD_DEST messages from a drag/drop list box to indicate the item that the
cursor is over.
lpObject
Pointer to the object being dragged.

Drag/Drop Well Notification
WM_COMMAND
Sent from the control to its parent window whenever certain events occur.
Members
wParam
Contains the window ID of the Column Manager control.
lParam
The LOWORD contains the handle to the window. The HIWORD contains one of the following
values.
Value |
Definition |
DDWN_DBLCLK |
The control was double-clicked. |
DDWN_PROMPT_BEGIN |
The mouse has passed into the control. |
DDWN_PROMPT_END |
The mouse has passed out of the control. |
The Drag/Drop Well control also sends notifications and requests to its parent via the Shared
Code registered message. For these messages, lParam contains the address of the
DDWDATA
structure associated with the control. wParam will be one of the values in the
following table.
Value and Definition
WPMSG_DD_ICONHINST
| The hInst where the control's icon resides should be returned
in the hInstIcon field. WPRES_SHARED,
WPRES_SHARED_RESOURCE, WPRES_TASK,
WPRES_TASK_RESOURCE can be used. If this message is
not handled, WPRES_SHARED_RESOURCE is assumed.
| WPMSG_DD_GETOBJECT
| A pointer to the drag/drop object should be returned in the
lpObject member of DDWDATA. The hCursor field of the
object can be the handle to the cursor to be displayed or 1 to
use the control's icon as the cursor.
| WPMSG_DD_RSVP
| dwRsvp in DDWDATA contains the response to a DDREQ...
message from the potential drag/drop client.
DDRSVP_FORMAT or DDRSVP_RENDER flags may be
set. DDRSVP_ACCEPT may be set when the object is
dropped. The hObject member of DDWDATA should not be
changed.
| WPMSG_DD_FREEOBJECT
| Indicates that the user released the mouse button. This means
the object may have been dropped (in which case a
WPMSG_DD_RSVP would have been sent) or the mouse
button was released over a window that could not accept the
object.
| WPMSG_DD_DEST
| This message is sent to the parent of a control that is a
drag/drop destination. All drag/drop well controls are
potential destinations; the parent must respond properly to
WPMSG_DD_DEST messages to actually enable drag/drop.
WP List Boxes may be drag/drop destinations if the
WLB_DRAGDROP message is sent to it to enable drag/drop.
The parent should process the drag/drop message packaged
inside the DDWDATA structure in WPMSG_DD_DEST
appropriately and then return the response in the dwRsvp
member of the DDWDATA structure that was sent. |

Filename Entry
The Filename Entry control is used to assist entry of filenames or directory paths by
providing a
browsing dialog box. The Filename Entry control appears as an edit field with a button to the
right that has a file folder icon. If the button is clicked or the F4 key is pressed, a dialog box
appears allowing the user to select a file or a directory.
The Filename Entry control is used like a normal edit control. It responds to most of the
same
messages as an edit control and sends notifications to its parent that include those for an edit
control. When you specify dimensions for the control, the button will be placed inside the
dimensions given and the edit field portion of the control will fill the remainder of the area.
Working examples of the definition and use of the Filename Entry control are in the sample
program. See Shared Code Sample Applications in the introductory section of this
manual.
Class Name
WCWP_FILENAME
Styles
FNES_FO_DOESNTHAVETOEXIST
The filename entered is not required to exist.
FNES_PATHNAME
This control will expect a directory path rather than a filename. When the control's button is
clicked to bring up the Select Directory dialog box, the path entered there will be validated
unless
the FNES_FO_DOESNTHAVETOEXIST style bit is also set. If the pathname entered is not
valid, an error message box will be displayed. If the pathname entered is valid, but does not
exist, a "Create? Yes or No" message box will be displayed, allowing the user to create the path.
Note that validation only occurs from the dialog box. If the user of this control wishes to
validate
what is typed into the edit portion of the control, the owner of the control must perform the
validation himself, usually on a KILLFOCUS message or notification.
FNES_PATHNAME_NOVALIDATE
The directory path will not be validated.

Filename Entry Functions
WfneGetEditHwnd
Gets the window handle of the edit portion of the Filename Entry control.
Prototype
HWND FAR PASCAL WfneGetEditHwnd ( HWND hwndFne );
Parameters
hwndFne
The window handle of the Filename Entry control.
Return Values
The window handle of the edit box portion of the control.

Filename Entry Messages
FNE_SETDEFDIR
Sets the default directory where the dialog box will be if the button is clicked to bring up the
browsing dialog box.
Members
wParam
0.
lParam
A far pointer to a string containing the default directory.
FNE_SETDEFTMPL
Sets the default filename template for the files to be displayed in the files list box of the
browsing
dialog box, if the button is clicked to bring up the browsing dialog box.
Members
wParam
0 Note: this NEEDS to be set to 0.
lParam
A far pointer to a string containing the default template. The default template is of the form of a
description followed by a quoted wildcard template in parentheses. For example:
Executable Files ("*.exe")
Multiple wildcards can be specified as well. Separate multiple wildcards with a space. For
example:
WordPerfect Macro Files ("*.wcm" "*.wpm")
If FNE_SETDEFTMPL is not sent, the default template is:
All Files ("*.*")
Additional Messages
The following standard edit control messages are also supported and passed through to the
edit
control child of the filename search control.
EM_CANUNDO
EM_EMPTYUNDOBUFFER
EM_GETMODIFY
EM_GETSEL
EM_LIMITTEXT
EM_REPLACESEL
EM_SETMODIFY
EM_SETSEL
EM_UNDO
WM_ENABLE
WM_GETDLGCODE
WM_GETFONT
WM_GETTEXT
WM_GETTEXTLENGTH
WM_SETTEXT

Filename Entry Notification
WM_COMMAND
Sent from the control to its parent window whenever certain events occur.
Members
wParam
The window ID of the Filename Entry control.
lParam
The LOWORD contains the handle to the window. The HIWORD contains zero or the following
value.
Value and Definition
FNEN_DLGDISMISS
| The Select File or Select Directory dialog box was dismissed
| FNEN_DLGRAISE
| The Select File or Select Directory dialog box was raised. |
Additional Notifications
The following standard edit control notifications are also supported and sent from the
Filename
Entry control to the Edit control child of the Filename Search control.
EN_CHANGE
EN_ERRSPACE
EN_HSCROLL
EN_KILLFOCUS
EN_MAXTEXT
EN_SETFOCUS
EN_UPDATE

Name Search List Box
The Name Search List Box provides a way to search for an item in a list box using the entire
text
of the item. This control is part of the Dialog Box Manager system. The Name Search List Box
is a custom control that implements WordPerfect style name search as a replacement for the
Windows standard first character search. It can be used just like a standard list box in dialog
boxes or windows. As each character is entered, a search string is displayed in a small window
located above the list box (this window can be moved to a different location by using
WPMSG_SET_NSLB_POPUP) and the best match is selected in the list box.
Name Search in a Sorted List Box
In a sorted list box a binary search is performed through the list box to find the item that
most
closely matches the search string. If the list box is owner-drawn, the parent of the list box is
asked to make the comparison through the WM_COMPAREITEM message. If the list box is not
owner-drawn, then a case-insensitive lexical comparison is made. This comparison does not
work if any of the characters that fall between 'Z' and 'a', namely [ \ ] ^ _ ' appear in the list box
item or the search string. A search is performed when a character is added or removed in the
search pop-up.
Name Search in an Unsorted List Box
In an unsorted list box, a sequential search is initiated from the item that currently has the
focus,
or if no item is selected, from the first item in the list box. The search wraps around from the end
of the list box to the start of the list box if necessary. A match occurs when a perfect prefix
match is found. If a perfect prefix match is not found, then the focus does not change. If the list
box is owner-drawn, then the owner of the list box is asked to make the comparison though the
WM_COMPAREITEM message. If the list box is not owner-drawn, then a case-insensitive
lexical comparison is made. This comparison does not work if any of the characters that fall
between 'Z' and 'a', namely [ \ ] ^ _ ' appear in the list box item or the search string. A search is
performed only when a character is added, not when one is removed.
Name Search in an Owner-Drawn List Box
In an owner-drawn list box, the owner of the list box is asked to perform each comparison
through the WM_COMPAREITEM message. There is an override capability to terminate the
search early; see the WM_COMPAREITEM message for details.
Name Search in Multiple and Extended Selection List Boxes
All previous selections are deselected with each character entered for a name search.
Name Search in Multicolumn and No-Integral-Height List Boxes
The name search pop-up will appear on the first column of a multicolumn list box, unless the
position is changed though the WPMSG_SET_NSLB_POPUP message. When a selection is
made, the list box will make sure the item selected is completely visible.
Working examples of the definition and use of the Name Search List Box control are in the
sample program. See Shared Code Sample Applications in the introductory section
of this
manual.
Class Name
WCWP_NS_LISTBOX

Name Search List Box Messages
NSLB_CANCELPOPUP
Sent to a Name Search List Box to cancel the name search and remove the pop-up name
search
box.
Members
wParam
0.
lParam
0L.
NSLB_QUERYPOPUP
Sent to a Name Search List Box to determine whether or not the name search pop-up is
active.
Members
wParam
0.
lParam
0L.
Return Values
Returns TRUE if name search pop-up is visible, FALSE otherwise.
WM_COMPAREITEM
This message is sent by an owner-drawn Name Search List Box to the parent of the list box
as a
request for it to perform a comparison.
Members
wParam
0.
lParam
Contains a long pointer to COMPAREITEMSTUCT data structure (see Windows Programmer's
Reference Vol. 3). A long pointer to the search string is contained in itemData2. The index of
the item in the list box to make the comparison with is contained in itemID1. The value of
itemData1 is undefined.
Return Values
-1 Item 1 sorts before the search string.
0 Item 1 matches the search string.
1 Item sorts after the search string.
itemID2 of the COMPAREITEMSTRUCT can be used to short-circuit the search. It is
initialized to 1 before the message is sent. If it is greater than 1 when the message is returned,
then the value in itemID2 is used as the item to select and no more comparisons are made.
In the COMPAREITEMSTRUCT that is received, the CtlType field will be set to
ODT_LISTBOX for WM_COMPAREITEM messages sent to sort items in the list box. When
the WM_COMPAREITEM message is sent because of activation of the name search feature, the
CtlType field will be set to ODT_NAMESEARCHLISTBOX.
WPMSG_SET_NSLB_POPUP
Sent as a Shared Code 7.x message by the Name Search List Box to the parent of
the list box to
allow the position of the pop-up to be changed.
Members
wParam
WPMSG_SET_NSLB_POPUP
lParam
A long pointer to a NSLBSIZESTRUCT data structure containing the handle of the list box and
an LPRECT to a rectangle containing the coordinates of the name search pop-up. The parent can
move the pop-up wherever it wishes by modifying this rectangle.
|