Copyright: Copyright (C) 1995,1996, ProtoView Development Corporation


	Date Edit Control
The PICS Date Edit OLE control is an edit control suitable for entering and selecting dates. The control functions much like a standard combo box control; however, instead of displaying a list of items, the Date Edit control displays a calendar from which the user can select a date.

The date edit control can manipulate dates from January 1, 1 to December 31, 9999. The date edit control accounts for the calendar reformation of 1753 and accurately displays dates prior to the reformation.


numeric expression

Any expression that can be evaluated as a number. Elements of the expression can include any combination of keywords, variables, constants, and operators that result in a number.


date expression

Date variables are stored as IEEE 64-bit (8-byte) floating-point numbers that represent dates ranging from 1 January 100 to 31 December 9999 and times from 0:00:00 to 23:59:59.  Any recognizable literal date values can be assigned to Date variables.  Literal dates must be enclosed within number sign characters (#), for example, #January 1, 1993# or #1 Jan 93#.

Date variables display dates according to the short date format recognized by your computer.  Times display according to the time format (either 12- or 24-hour) recognized by your computer.

When other numeric data types are converted to Date, values to the left of the decimal represent date information while values to the right of the decimal represent time.  Midnight is 0 and midday is .5.  Negative whole numbers represent dates before 30 December 1899.


Boolean expression

An expression that evaluates to either True or False.


string expression

Any expression that evaluates to a sequence of contiguous characters. Elements of the expression can include a function that returns a string, a string literal, a string constant, a string variable, a string Variant, or a function that returns a string Variant (Var Type 8).


object expression

An expression that specifies a particular object.  The expression can include any of the object’s containers.  For example, if your application has an Application object that contains a Document object that contains a Text object, the following are valid object expressions:

Application.Document.Text

Application.Text

Document.Text

Text


constant

A named item that retains a constant value throughout the execution of a program, as opposed to a variable, whose value can change during execution.  Each host application can define its own set of constants.  Additional constants may be defined by the user with the Const statement.  Constants can be used anywhere in your code in place of actual values.  A constant may be a string or a numeric literal, another constant, or any combination that includes arithmetic or logical operators except ls or exponentiation.  For example:

Const A = “My String”


object library

A file with the .OLB extension that provides information to OLE Automation controllers (like Visual Basic) about available OLE Automation objects.  You can use the Object Browser to examine the contents of an object library to get information about the objects provided.


Object Browser

A dialog box that lets you examine the contents of an object library to get information about the objects provided.


Control Panel

A set of programs that control your system configuration.  You use Control Panel utilities to adjust hardware and software options, such as desktop colors, printer selections, date and number formats, fonts, and locale settings, such as language and system of measurement.


design time

The time during which you build an application in the development environment by adding controls, setting control or form properties, and so on.  In contrast, during run time, you interact with the application as a user would.


run time

The time when code is running. During run time, you interact with the application as a user would.


multicolumn TreeView control

A multicolumn TreeView control is a TreeView control with its data arranged in a set of columns that go across the page. As opposed to the normal style, where all the data is arranged in a single column down the page.


Properties window

A window used to display or change properties of a selected form or control at design-time. Some custom controls have customized Property windows.


bitmap

An image represented by pixels and stored as a collection of bits in which each bit corresponds to one pixel. On color systems, more than one bit corresponds to each pixel. A bitmap usually has a .BMP filename extension.


icon

A graphical representation of an object or concept commonly used to represent minimized applications in Microsoft Windows. Essentially, an icon is a bitmap with a maximum size of 32 x 32 pixels. Icons have an .ICO filename extension.


metafile

A file that stores an image as graphical objects (lines, circles, polygons) rather than as pixels. There are two types of metafiles, standard and enhanced. Standard metafiles usually have a .WMF filename extension. Enhanced metafiles usually have an .EMF filename extension. Metafiles preserve an image more accurately than pixels when the image is resized.


Empty Branch Object

An empty Branch object is a Branch object that does not have an associated TreeView control item. Methods that return Branch objects may return an empty Branch object to signify the end of a list or a search failure. You can detect an empty Branch by using the IsValid member function.


	Font Property
Returns a Font object.

Syntax

Visual Basic	object.Font

Visual C++	COleFont object.GetFont();

void object.SetFont(LPDISPATCH pIOleFont);

The Font property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

Remarks

Use the Font property of an object to identify a specific Font object whose properties you want to use. For example, the following code changes the Bold property setting of a Font object identified by the Font property of a TextBox object:

Visual Basic

txtFirstName.Font.Bold = True

Visual C++

pIOleFont->SetBold(TRUE);

txtFirstName.SetFont(pIOleFont);


	Enabled Property
Returns or sets a value that determines whether a form or control can respond to user-generated events.

Syntax

Visual Basic	object.Enabled [= boolean]

Visual C++	BOOL object.GetEnabled();

object.SetEnabled(BOOL boolean);

The Enabled property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

boolean	A Boolean expression that specifies whether object can respond to user-generated events.

Settings

The settings for boolean are:

Setting	Description

True	(Default) Allows object to respond to events.

False	Prevents object from responding to events.

Remarks

The Enabled property allows forms and controls to be enabled or disabled at run time.  For example, you can disable objects that don't apply to the current state of the application.  You can also disable a control used purely for display purposes, such as a text box that provides read-only information.


	hWnd Property
Returns a handle to a DateEdit control. Read-only at run time, not available at design time.

Syntax

Visual Basic	object.hWnd

Visual C++	OLE_HANDLE object.GetHWnd();

The object placeholder represents an object expression that evaluates to DateEdit control.

Remarks

The Microsoft Windows operating environment identifies each form and control in an application by assigning it a handle, or hWnd. The hWnd property is used with Windows API calls. Many Windows operating environment functions require the hWnd of the active window as an argument.

Note  Because the value of this property can change while a program is running, never store the hWnd value in a variable.


PICS Date Edit AboutBox Method
	AboutBox Method
Use the About command to find the version number and other pertinent information about PICS.


You have specified a number outside of the range 1-12 in the SetMonthLiteral method. The first argument of the SetMonthLiteral method specifies which month literal is to be changed. This value must fall between the numbers 1 (for January) through 12 (for December).

See SetMonthLiteral Method


You have attempted to change the value of the Appearance property at run-time. The Appearance property is read-only at run time. You may change the value of this property in the property sheet for the Date Edit control at design time.

See Appearance Property


You have attempted to change the value of the BorderStyle property at run-time. The BorderStyle property is read-only at run time. You may change the value of this property in the property sheet for the Date Edit control at design time.

See BorderStyle Property


	Change Event
The Change event is fired whenever the contents of the DateEdit control changes.

Syntax

Visual Basic	Private Sub Object_Change([index As Integer])

Visual C++	void OnChangeObject();

The Change method syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.


	Appearance Property
Returns or sets the paint style of a DateEdit control. Read only at run time.

Syntax

Visual Basic	object.Appearance

Visual C++	short object.GetAppearance();

The object placeholder represents an object expression that evaluates to DateEdit control.

Settings

The Appearance property settings are:

Setting	Description

0	Flat.  Paints controls and forms with without visual effects.

1	(Default) 3D.  Paints controls with three-dimensional effects.

Remarks

If set to 1 at design time, the Appearance property draws the control with three-dimensional effects. Setting the Appearance property to 1 also disables the BorderStyle Property.


	BorderStyle Property
Returns or sets the border style for a DateEdit object, read only at run time.

Syntax

Visual Basic	object.BorderStyle

Visual C++	int object.GetBorderStyle();

The object placeholder represents an object expression that evaluates to DateEdit control.

Settings

The BorderStyle property settings for a DateEdit control are:

Setting	Description

0	(Default) None.

1	Fixed Single.

Remarks

The BorderStyle property is not active unless the Appearance Property is set to 0.


	BackColor Property
BackColor returns or sets the background color of an object.

ForeColor returns or sets the foreground color used to display text and graphics in an object.

Syntax

Visual Basic	object.BackColor [= color]

object.ForeColor [= color]

Visual C++	OLE_COLOR object.GetBackColor();

OLE_COLOR object.GetForeColor();

object.SetBackColor(OLE_COLOR color);

object.SetForeColor(OLE_COLOR color);

The BackColor and ForeColor property syntax’s have these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

color	A value or constant that determines the background or foreground colors of an object, as described in Settings.

Settings

Visual Basic uses the Microsoft Windows operating environment red-green-blue (RGB) color scheme.  The settings for color are:

Setting	Description

Normal RGB colors	Colors specified by using the Color palette or by using the RGB or QBColor functions in code.

System default colors	Colors specified by system color constants listed in the Visual Basic (VB) object library in the Object Browser.  The Windows operating environment substitutes the user's choices as specified in the Control Panel settings.

For all forms and controls, the default settings at design time are:

BackColor set to the system default color specified by the constant vbWindowBackground.

ForeColor set to the system default color specified by the constant vbWindowText.

Remarks

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF).  The high byte of a number in this range equals 0; the lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively.  The red, green, and blue components are each represented by a number between 0 and 255 (&HFF).  If the high byte isn't 0, Visual Basic uses the system colors, as defined in the user's the Control Panel settings and by constants listed in the Visual Basic (VB) object library in the Object Browser.

To display text in the Windows operating environment, both the text color must be solid.  If the text color you've selected isn’t displayed, the selected colors may be dithered, that is, comprised of up to three different-colored pixels.  If you choose a dithered color for the text, the nearest solid color will be substituted.


How to contact ProtoView
	Contact ProtoView
You may contact ProtoView Development Corporation at:

CompuServe:	GO PROTOVIEW

Phone: 	(609) 655-5000

Fax:	(609) 655-5353


	DateFormat Property
The DateFormat property controls the display format of the date presented in the DateEdit control.

Syntax

Visual Basic	object.DateFormat [= %format%]

Visual C++	short object.GetDateFormat();

void object.SetDateFormat(short format);

The DateFormat property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit Control.
%format%	Must be one of the following manifest constants
	fmtMDY	Displays the date in the mm/dd/yy format.
	fmtDMY	Displays the date in the dd/mm/yy format
	fmtYMD	Displays the date in the yy/mm/dd format


	EnableCalendar Property
The EnableCalendar property controls whether or not the calendar drop down button is displayed on the DateEdit control.

Syntax

Visual Basic	object.EnableCalendar[= boolean]

Visual C++	BOOL object.GetEnableCalendar();

object.SetEnableCalendar(BOOL boolean);

The EnableCalendar property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

boolean	A Boolean expression that specifies whether object can display a drop down calendar.

Remarks

The EnableCalendar property controls whether or not the calendar drop down button is displayed on the DateEdit control. If the EnableCalendar property is set to True, the DateEdit control displays a calendar drop down button, allowing the user to set the date using the mouse. When set to False, no calendar drop down button is displayed.


	ForeColor Property
BackColor returns or sets the background color of an object.

ForeColor returns or sets the foreground color used to display text and graphics in an object.

Syntax

Visual Basic	object.BackColor [= color]

object.ForeColor [= color]

Visual C++	OLE_COLOR object.GetBackColor();

OLE_COLOR object.GetForeColor();

object.SetBackColor(OLE_COLOR color);

object.SetForeColor(OLE_COLOR color);

The BackColor and ForeColor property syntax’s have these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

color	A value or constant that determines the background or foreground colors of an object, as described in Settings.

Settings

Visual Basic uses the Microsoft Windows operating environment red-green-blue (RGB) color scheme.  The settings for color are:

Setting	Description

Normal RGB colors	Colors specified by using the Color palette or by using the RGB or QBColor functions in code.

System default colors	Colors specified by system color constants listed in the Visual Basic (VB) object library in the Object Browser.  The Windows operating environment substitutes the user's choices as specified in the Control Panel settings.

For all forms and controls, the default settings at design time are:

BackColor set to the system default color specified by the constant vbWindowBackground.

ForeColor set to the system default color specified by the constant vbWindowText.

Remarks

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF).  The high byte of a number in this range equals 0; the lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively.  The red, green, and blue components are each represented by a number between 0 and 255 (&HFF).  If the high byte isn't 0, Visual Basic uses the system colors, as defined in the user's the Control Panel settings and by constants listed in the Visual Basic (VB) object library in the Object Browser.

To display text in the Windows operating environment, both the text color must be solid.  If the text color you've selected isn’t displayed, the selected colors may be dithered, that is, comprised of up to three different-colored pixels. If you choose a dithered color for the text, the nearest solid color will be substituted.


	GetDateString Method
Returns a string representation of the date.

Important   This object requires either Microsoft Windows 95 or Microsoft Windows NT version 3.51 or higher.

Syntax

Visual Basic	BSTR object.GetDateString

Visual C++	CString object::GetDateString();

The GetDateString method syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

Returns

The method returns a string that represents the date in the control.


	HideDropDown Event
The HideDropDown event is fired whenever the calendar drop down is about to be hidden.

Syntax

Visual Basic	Private Sub Object_HideDropDown([index As Integer])

Visual C++	void OnHideDropDownObject();

The HideDropDown event syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.


	IgnoreKeyboard Property
The IgnoreKeyboard property controls whether nor not the DateEdit control will accept keyboard input.

Syntax

Visual Basic	object.IgnoreKeyboard [= boolean]

Visual C++	BOOL object.GetIgnoreKeyboard();

object.SetIgnoreKeyboard(BOOL boolean);

The IgnoreKeyboard property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

boolean	A Boolean expression that specifies whether object can respond to keyboard events. A value True disables keyboard input for the control. An enabled control can accept keyboard input. A value of False enables keyboard input for the control.

Remarks

The IgnoreKeyboard property works in much the same way as the Enabled Property. However, the IgnoreKeyboard only enables or disables keyboard input. A control with keyboard input disabled can still accept and respond to mouse events.


	DayLeadingZero Property
The DayLeadingZero property controls the way numbers below 10 are displayed in the date.

Syntax

Visual Basic	object.DayLeadingZero [= boolean]

Visual C++	BOOL object.GetDayLeadingZero();

object.SetDayLeadingZero(BOOL boolean);

The DayLeadingZero property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

boolean	A Boolean expression that specifies how object displays dates. A value True causes all numbers below 10 to be displayed with a leading zero. For example, the date February 3, 1995 will be displayed as 02/03/1995. A value of False will not force a leading zero on numbers below 10, i.e., 2/3/1995.


	Seperator Property
The Seperator property is the character used to separate the different parts of a date when the date is shown in the mm/dd/yy, dd/mm/yy or yy/mm/dd formats.

Syntax

Visual Basic	object.Seperator [= SeperatorCharacter$]

Visual C++	CString object.GetSeperator();

void object.SetSeperator(LPCTSTR SeperatorCharacter);

The Seperator property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit Control.
SeperatorCharacter$	A single character string that holds the seperator character. If the string contains more than one character, the first character of the string is used as the seperator character.
Remarks

The Seperator property is used to separate the different parts of the date. The seperator character is placed between the month, day and year portions of the date when the date is displayed in the mm/dd/yy, dd/mm/yy or yy/mm/dd formats.


	SetDayLiteral Method
Sets the text used to represent the day of the week in the date string.

Syntax

Visual Basic	object.SetDayLiteral ( literal )

Visual C++	void object::SetDayLiteral(LPCTSTR literal);

The SetDayLiteral method syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

literal	The text string that will represent the day of the week.

Remarks

You can use this method to make the DateEdit control suitable for international programs.

The SetDayLiteral is used to set the text string that represents a day, i.e., “Sunday” for the first day of the week, while the SetDOWLiteral is used to set the single character representation of that day, i.e., “S”.


	SetMonthLiteral Method
Sets the text used to represent the month in the date string.

Syntax

Visual Basic	object.SetMonthLiteral ( literal )

Visual C++	void object::SetMonthLiteral(short LPCTSTR literal);

The SetMonthLiteral method syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

literal	The text string that will represent the month.

Remarks

You can use this method to make the DateEdit control suitable for international programs.


PICS Date Edit Properties

 Appearance

 BorderStyle

 BackColor

 DateFormat

 DayLeadingZero

 DisplayFormat

 EnableCalendar

 Enabled

 Font

 ForeColor

 hWnd

 IgnoreKeyboard

 MonthLeadingZero

 Seperator

 ShowCentury

 UseDefaultFormat

 Value


PICS Date Edit Events

 Change

 Click

 HideDropDown

 KeyDown

 KeyPress

 KeyUp

 MouseDown

 MouseMove

 MouseUp

 ShowDropDown


PICS Date Edit Methods

 AboutBox

 GetDateString

 IsNull

 SetDayLiteral

 SetDOWLiteral

 SetMonthLiteral

 SetNull


	Value Property
The Value property represents the date in the DateEdit control.

Syntax

Visual Basic	object [= date]

object.Value [= date]

Visual C++	DATE object.GetValue();

void object.SetValue(DATE date);

The Value property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit Control.
date	A date value.
Remarks

The Value property is the default property of the DateEdit control.


	ShowCentury Property
Controls the way the year is displayed in a DateEdit control.

Syntax

Visual Basic	object.ShowCentury [= boolean]

Visual C++	BOOL object.GetShowCentury();

object.SetShowCentury(BOOL boolean);

The ShowCentry property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

boolean	A Boolean expression that specifies how object displays the year. A value True causes the DateEdit control to display the full year, including the century. Only the last two digits of the year are displayed if this property is set to False.

Remarks

When the ShowCentury property is set to False, dates edited in the DateEdit control retain the century of the original date. The user may change the century by selecting the appropriate year in the calendar dropdown.


	ShowDropDown Event
The ShowDropDown event is fired whenever the calendar drop down is about to be shown.

Syntax

Visual Basic	Private Sub Object_ShowDropDown([index As Integer])

Visual C++	void OnShowDropDownObject();

The ShowDropDown method syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.


PICS DateEdit Click Event
	Click Event
Occurs when the user presses and then releases a mouse button over an object.  It can also occur when the value of a control is changed.

Syntax

Visual Basic	Private Sub Object_Click([index As Integer])

Visual C++	void OnClickObject();

The Click event syntax has these parts:

Part	Description

Object	An object expression that evaluates to DateEdit object.

index	An integer that uniquely identifies a control if it's in a control array.

Remarks

For a control, this event occurs when the user:

•	Clicks a control with the left or right mouse button.  With a 3D check box, 3D command button, or 3D option button control, the Click event occurs only when the user clicks the left mouse button.

•	Presses the SPACEBAR when a 3D command button, 3D option button, or 3D check box control has the focus.

•	Presses ENTER when a form has a 3D command button control with its Default property set to True.

•	Presses ESC when a form has a Cancel buttonfor example, a 3D command button control with its Cancel property set to True.

•	Presses an access key for a control.  For example, if the caption of a 3D command button control is "&Go", pressing ALT+G triggers the event.

Typically, you attach a Click event procedure to a 3D command button control to carry out commands and command-like actions.  For the other applicable controls, use this event to trigger actions in response to a change in the control.

Note   To distinguish between the left, right, and middle mouse buttons, use the MouseDown and MouseUp events.


PICS DateEdit MouseDown Event
	MouseDown Event
Occur when the user presses (MouseDown) or releases (MouseUp) a mouse button.

Syntax

Visual Basic	Private Sub Object_MouseDown([index As Integer,] Button As Integer, Shift As Integer, x As Single, y As Single)

Visual C++	void OnMouseDownObject(short Button, short Shift, long x, long y);

The MouseDown event syntax has these parts:

Part	Description

Object	An object expression that evaluates to DateEdit object.

index	Returns an integer that uniquely identifies a control if it's in a control array.

Button	Returns an integer that identifies the button that was pressed (MouseDown) or released (MouseUp) to cause the event.  The Button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2).  These bits correspond to the values 1, 2, and 4, respectively.  Only one of the bits is set, indicating the button that caused the event.

Shift	Returns an integer that corresponds to the state of the SHIFT, CTRL, and ALT keys when the button specified in the Button argument is pressed or released.  A bit is set if the key is down.  The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ).  These bits correspond to the values 1, 2, and 4, respectively.  The Shift argument indicates the state of these keys.  Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed.  For example, if both CTRL and ALT were pressed, the value of shift would be 6.

x, y	Returns a number that specifies the current location of the mouse pointer.  The x  and y values are always expressed in terms of the coordinate system set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties of the object.

Remarks

Use a MouseDown or MouseUp event procedure to specify actions that will occur when a given mouse button is pressed or released.  Unlike the Click and DblClick events, MouseDown and MouseUp events enable you to distinguish between the left, right, and middle mouse buttons.  You can also write code for mouse-keyboard combinations that use the SHIFT, CTRL, and ALT keyboard modifiers.

The following applies to both Click and DblClick events:

•	If a mouse button is pressed while the pointer is over a control, that object "captures" the mouse and receives all mouse events up to and including the last MouseUp event.  This implies that the x, y mouse-pointer coordinates returned by a mouse event may not always be in the client area of the object that receives them.

•	If mouse buttons are pressed in succession, the object that captures the mouse after the first press receives all mouse events until all buttons are released.

If you need to test for the button or shift arguments, you can use constants listed in the object library in the Object Browser to define the bits within the argument:

Constant	Value	Description

vbLeftButton	1	Left button is pressed.

vbRightButton	2	Right button is pressed.

vbMiddleButton	4	Middle button is pressed.

vbShiftMask	1	SHIFT key is pressed.

vbCtrlMask	2	CTRL key is pressed.

vbAltMask	4	ALT key is pressed.

The constants then act as bit masks you can use to test for any combination of buttons without having to figure out the unique bit field value for each combination.


PICS DateEdit MouseUp Event
	MouseUp Event
Occur when the user presses (MouseDown) or releases (MouseUp) a mouse button.

Syntax

Visual Basic	Private Sub Object_MouseUp([index As Integer,] Button As Integer, Shift As Integer, x As Single, y As Single)

Visual C++	void OnMouseUpObject(short Button, short Shift, long x, long y);

The MouseUp event syntax has these parts:

Part	Description

Object	An object expression that evaluates to Button object.

index	Returns an integer that uniquely identifies a control if it's in a control array.

Button	Returns an integer that identifies the button that was pressed (MouseDown) or released (MouseUp) to cause the event.  The Button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2).  These bits correspond to the values 1, 2, and 4, respectively.  Only one of the bits is set, indicating the button that caused the event.

Shift	Returns an integer that corresponds to the state of the SHIFT, CTRL, and ALT keys when the button specified in the Button argument is pressed or released.  A bit is set if the key is down.  The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ).  These bits correspond to the values 1, 2, and 4, respectively.  The Shift argument indicates the state of these keys.  Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed.  For example, if both CTRL and ALT were pressed, the value of shift would be 6.

x, y	Returns a number that specifies the current location of the mouse pointer.  The x  and y values are always expressed in terms of the coordinate system set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties of the object.

Remarks

Use a MouseDown or MouseUp event procedure to specify actions that will occur when a given mouse button is pressed or released.  Unlike the Click and DblClick events, MouseDown and MouseUp events enable you to distinguish between the left, right, and middle mouse buttons.  You can also write code for mouse-keyboard combinations that use the SHIFT, CTRL, and ALT keyboard modifiers.

The following applies to both Click and DblClick events:

•	If a mouse button is pressed while the pointer is over a control, that object "captures" the mouse and receives all mouse events up to and including the last MouseUp event.  This implies that the x, y mouse-pointer coordinates returned by a mouse event may not always be in the client area of the object that receives them.

•	If mouse buttons are pressed in succession, the object that captures the mouse after the first press receives all mouse events until all buttons are released.

If you need to test for the button or shift arguments, you can use constants listed in the object library in the Object Browser to define the bits within the argument:

Constant	Value	Description

vbLeftButton	1	Left button is pressed.

vbRightButton	2	Right button is pressed.

vbMiddleButton	4	Middle button is pressed.

vbShiftMask	1	SHIFT key is pressed.

vbCtrlMask	2	CTRL key is pressed.

vbAltMask	4	ALT key is pressed.

The constants then act as bit masks you can use to test for any combination of buttons without having to figure out the unique bit field value for each combination.


PICS DateEdit KeyDown Event
	KeyDown Event
Fired each time a key is pressed when the Button object has input focus.

Syntax

Visual Basic	Private Sub Object_KeyDown([index As Integer,] KeyCode As Integer, Shift As Integer)

Visual C++	void OnKeyDownObject(short FAR* KeyCode, short Shift);

The KeyDown event syntax has these parts:

Part	Description

Object	An object expression that evaluates to Button object.

index	An integer that uniquely identifies a control if it's in a control array.

KeyCode	A key code, such as vbKeyF1 (the F1 key) or vbKeyHome (the HOME key).  To specify key codes, use the constants in the object library in the Object Browser.

Shift	An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event. The Shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2).  These bits correspond to the values 1, 2, and 4, respectively.  Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed.  For example, if both CTRL and ALT are pressed, the value of Shift is 6.

Remarks

The object with the focus receives all keystrokes. Although the KeyDown and KeyUp events can apply to most keys, they're most often used for:

•	Extended character keys such as function keys.

•	Navigation keys.

•	Combinations of keys with standard keyboard modifiers.

•	Distinguishing between the numeric keypad and regular number keys.

Use KeyDown and KeyUp event procedures if you need to respond to both the pressing and releasing of a key.

KeyDown and KeyUp aren't invoked for:

•	The ENTER key if the form has a 3D command button control with the Default property set to True.

•	The ESC key if the form has a 3D command button control with the Cancel property set to True.

•	The TAB key.

KeyDown and KeyUp interpret the uppercase and lowercase of each character by means of two arguments: KeyCode, which indicates the physical key (thus returning A and a as the same key) and Shift, which indicates the state of shift+key and therefore returns either A or a.

If you need to test for the Shift argument, you can declare constants that define the bits within the argument by using constants listed in the object library in the Object Browser.  The shift constants have the following values:

Constant	Value

vbShiftMask	1

vbCtrlMask	2

vbAltMask	4

The constants act as bit masks that you can use to test for any combination of keys.  Place the constants at the procedure level or in the Declarations section of a module and use this syntax:

Const constantname = expression

You test for a condition by first assigning each result to a temporary integer variable and then comparing Shift to a bit mask.  Use the And operator with the Shift argument to test whether the condition is greater than 0, indicating that the modifier was pressed, for example:

ShiftDown = (Shift And vbShiftMask) > 0

In a procedure, you can test for any combination of conditions, for example:

If ShiftDown And CtrlDown Then

Note   If the KeyPreview property is set to True, a form receives these events before controls on the form receive the events.  Use the KeyPreview property to create global keyboard-handling routines.


PICS DateEdit KeyPress Event
	KeyPress Event
Fired each time a key is pressed when the Button object has input focus.

Syntax

Visual Basic	Private Sub Object_KeyPress([index As Integer,] KeyAscii As Integer)

Visual C++	void OnKeyPressObject(short FAR* KeyAscii);

The KeyPress event syntax has these parts:

Part	Description

Object	An object expression that evaluates to Button object.

index	An integer that uniquely identifies a control if it's in a control array.

KeyAscii	An integer that returns a standard numeric ANSI keycode.  The KeyAscii argument is passed by reference; changing it sends a different character to the object.  Changing KeyAscii to 0 cancels the keystroke so the object receives no character.

Remarks

The object with the focus receives the event.  A form can receive the event only if it has no visible and enabled controls or if the KeyPreview property is set to True.  A KeyPress event can involve any printable keyboard character, the CTRL key combined with a character from the standard alphabet or one of a few special characters, and the ENTER or BACKSPACE key. Changing the value of the KeyAscii argument changes the character displayed.

You can convert the KeyAscii argument into a character by using the expression:

Chr(KeyAscii)

You can then perform string operations and translate the character back to an ANSI number that the control can interpret by using the expression:

KeyAscii = Asc(char)

Use KeyDown and KeyUp event procedures to handle any keystroke not recognized by KeyPress, such as function keys, editing keys, navigation keys, and any combinations of these with keyboard modifiers.  Unlike the KeyDown and KeyUp events, KeyPress doesn't indicate the physical state of the keyboard; instead, it passes a character.

KeyPress interprets the uppercase and lowercase of each character as separate key codes and, therefore, as two separate characters.  KeyDown and KeyUp interpret the uppercase and lowercase of each character by means of two arguments: keycode, which indicates the physical key (thus returning A and a as the same key), and shift, which indicates the state of shift+key and therefore returns either A or a.

If the KeyPreview property is set to True, a form receives the event before controls on the form receive the event.  Use the KeyPreview property to create global keyboard-handling routines.

Note   The ANSI number for the keyboard combination of CTRL+@ is 0.  Because Visual Basic recognizes a KeyAscii value of 0 as a zero-length string (""), avoid using CTRL+@ in your applications.


PICS DateEdit KeyUp Event
	KeyUp Event
Fired each time a key is released when the Button object has input focus.

Syntax

Visual Basic	Private Sub Object_KeyUp([index As Integer,] KeyCode As Integer, Shift As Integer)

Visual C++	void OnKeyUpObject(short FAR* KeyCode, short Shift);

The KeyUp event syntax has these parts:

Part	Description

Object	An object expression that evaluates to Button object.

index	An integer that uniquely identifies a control if it's in a control array.

KeyCode	A key code, such as vbKeyF1 (the F1 key) or vbKeyHome (the HOME key).  To specify key codes, use the constants in the object library in the Object Browser.

Shift	An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event. The Shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2).  These bits correspond to the values 1, 2, and 4, respectively.  Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed.  For example, if both CTRL and ALT are pressed, the value of Shift is 6.

Remarks

The object with the focus receives all keystrokes. Although the KeyDown and KeyUp events can apply to most keys, they're most often used for:

•	Extended character keys such as function keys.

•	Navigation keys.

•	Combinations of keys with standard keyboard modifiers.

•	Distinguishing between the numeric keypad and regular number keys.

Use KeyDown and KeyUp event procedures if you need to respond to both the pressing and releasing of a key.

KeyDown and KeyUp aren't invoked for:

•	The ENTER key if the form has a 3D command button control with the Default property set to True.

•	The ESC key if the form has a 3D command button control with the Cancel property set to True.

•	The TAB key.

KeyDown and KeyUp interpret the uppercase and lowercase of each character by means of two arguments: KeyCode, which indicates the physical key (thus returning A and a as the same key) and Shift, which indicates the state of shift+key and therefore returns either A or a.

If you need to test for the Shift argument, you can declare constants that define the bits within the argument by using constants listed in the object library in the Object Browser.  The shift constants have the following values:

Constant	Value

vbShiftMask	1

vbCtrlMask	2

vbAltMask	4

The constants act as bit masks that you can use to test for any combination of keys.  Place the constants at the procedure level or in the Declarations section of a module and use this syntax:

Const constantname = expression

You test for a condition by first assigning each result to a temporary integer variable and then comparing Shift to a bit mask.  Use the And operator with the Shift argument to test whether the condition is greater than 0, indicating that the modifier was pressed, for example:

ShiftDown = (Shift And vbShiftMask) > 0

In a procedure, you can test for any combination of conditions, for example:

If ShiftDown And CtrlDown Then

Note   If the KeyPreview property is set to True, a form receives these events before controls on the form receive the events.  Use the KeyPreview property to create global keyboard-handling routines.


PICS DateEdit MouseMove Event
	MouseMove Event
Occurs when the user moves the mouse.

Syntax

Visual Basic	Private Sub Object_MouseMove([index As Integer,] Button As Integer, Shift As Integer, x As Single, y As Single)

Visual C++	void OnMouseMoveObject(short Button, short Shift, long x, long y);

The MouseDown event syntax has these parts:

Part	Description

Object	An object expression that evaluates to Calendar object.

index	Returns an integer that uniquely identifies a control if it's in a control array.

Button	An integer that corresponds to the state of the mouse buttons in which a bit is set if the button is down.  The Button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2).  These bits correspond to the values 1, 2, and 4, respectively.  It indicates the complete state of the mouse buttons; some, all, or none of these three bits can be set, indicating that some, all, or none of the buttons are pressed.

Shift	An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys.  A bit is set if the key is down.  The Shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ).  These bits correspond to the values 1, 2, and 4, respectively.  The Shift argument indicates the state of these keys.  Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed.  For example, if both CTRL and ALT were pressed, the value of shift would be 6.

x, y	Returns a number that specifies the current location of the mouse pointer.  The x  and y values are always expressed in terms of the coordinate system set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties of the object.

Remarks

The MouseMove event is generated continually as the mouse pointer moves across objects.  Unless another object has captured the mouse, an object recognizes a MouseMove event whenever the mouse position is within its borders.

If you need to test for the button or shift arguments, you can use constants listed in the object library in the Object Browser to define the bits within the argument:

Constant	Value	Description

vbLeftButton	1	Left button is pressed.

vbRightButton	2	Right button is pressed.

vbMiddleButton	4	Middle button is pressed.

vbShiftMask	1	SHIFT key is pressed.

vbCtrlMask	2	CTRL key is pressed.

vbAltMask	4	ALT key is pressed.

The constants then act as bit masks you can use to test for any combination of buttons without having to figure out the unique bit field value for each combination.

You test for a condition by first assigning each result to a temporary integer variable and then comparing the button or shift arguments to a bit mask.  Use the And operator with each argument to test if the condition is greater than zero, indicating the key or button is pressed, as in the following code:

LeftDown = (Button And vbLeftButton) > 0

CtrlDown = (Shift And vbCtrlMask) > 0

Then, in a procedure, you can test for any combination of conditions, as follows:

If LeftDown And CtrlDown Then

Note   You can use MouseDown and MouseUp event procedures to respond to events caused by pressing and releasing mouse buttons.

The button argument for MouseMove differs from the button argument for MouseDown and MouseUp.  For MouseMove, the button argument indicates the current state of all buttons; a single MouseMove event can indicate that some, all, or no buttons are pressed.  For MouseDown and MouseUp, the button argument indicates exactly one button per event.

Any time you move a window inside a MouseMove event, it can cause a cascading event.  MouseMove events are generated when the window moves underneath the pointer.  A MouseMove event can be generated even if the mouse is perfectly stationary.


	DisplayFormat Property
The UseDefaultFormat property controls the display format of the date presented in the DateEdit control.

Syntax

Visual Basic	object.DisplayFormat [= format]

Visual C++	short object.GetDisplayFormat();

void object.SetDisplayFormat(short format);

The DisplayFormat property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

format	Must be one of the following manifest constants.

fmtNORMAL	Displays the date in the normal style.

fmtLED	Displays the date using an LED style.

fmtODOMETER	Displays the date using an odometer style.


	SetDOWLiteral Method
Sets the text used to represent the day of the week in the date string.

Syntax

Visual Basic	object.SetDOWLiteral ( literal )

Visual C++	void object::SetDOWLiteral(shorLPCTSTR literal);

The SetDOWLiteral method syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

literal	The text string that will represent the day of the week.

Remarks

You can use this method to make the DateEdit control suitable for international programs.

The SetDayLiteral is used to set the text string that represents a day, i.e., “Sunday” for the first day of the week, while the SetDOWLiteral is used to set the single character representation of that day, i.e., “S”.


	MonthLeadingZero Property
The MonthLeadingZero property controls the way numbers below 10 are displayed in the DateEdit control.

Syntax

Visual Basic	object.MonthLeadingZero [= boolean]

Visual C++	BOOL object.GetMonthLeadingZero();

object.SetMonthLeadingZero(BOOL boolean);

The MonthLeadingZero property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

boolean	A Boolean expression that specifies how object displays dates. A value True causes all numbers below 10 to be displayed with a leading zero. For example, the date February 3, 1995 will be displayed as 02/03/1995. A value of False will not force a leading zero on numbers below 10, i.e., 2/3/1995.


	IsNull Method
Returns True if the DateEdit control contains a null date.

Syntax

Visual Basic	Bool object.IsNull

Visual C++	BOOL object::IsNull();

The IsNull method syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

Returns

The method returns True if there is no date in the DateEdit control.


	SetNull Method
Empties the DateEdit control.

Syntax

Visual Basic	object.IsNull

Visual C++	void object::IsNull();

The SetNull method syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

Returns

The method erases the date in a DateEdit control and leaves the control blank.


	UseDefaultFormat Property
The UseDefaultFormat property controls the display format of the date presented in the DateEdit control.

Syntax

Visual Basic	object.UseDefaultFormat [= boolean]

Visual C++	BOOL object.GetUseDefaultFormat();

void object.SetUseDefaultFormat(BOOL boolean);

The UseDefaultFormat property syntax has these parts:

Part	Description

object	An object expression that evaluates to a DateEdit control.

boolean	A Boolean expression that specifies whether object should display the date using the windows format (as specified in the control panel settings) or display the date according to the controls property settings.

Remarks

If the UseDefaultFormat property is set to True, the settings for ShowCentury, DayLeadingZero,MonthLeadingZero, and Seperator are ignored and the cooresponding settings found in the Windows Control Panel are used instead.