VDPush v1.3 June 1998

Description The VDPush command button control is the 32-bit OLE Control sequel to the popular freeware DBPush VBX. Since DBPush was developed during quite some time to meet requests and demands, this inevitably led to some inconstancies. Therefore, VDPush is not 100% compatible with DBPush. Following the guidelines under the section "Migrating DBPush" you will still be able to move a 16-bit project using DBPush into the 32-bit environment.
File Name VDGT.OCX
Class name VDPush
About This control was developed by Visual Design Softscape AB. For more information, visit us at www.visual-design.se, or contact us at info@visual-design.se.
Distribution As soon as you have licensed the control, you may distribute it freely along with your EXE files.
Disclaimer Disclaimer

Release history

Apr 96 v0.1 First beta release.
Aug 96 v1.0 BUGFIX: Enter & Esc keys didn't trigger buttons with Default or Cancel set to True.
v1.1 New property: TransStoreMask
Nov 96 v1.11 The SinkDeep property now causes the black outline edge to be drawn on left & top sides when depressed. This is consistent with standard toolbar buttons.
The AutoPictureDisabled feature used hard coded colors to create disabled pictures. It now uses the LightColor and DarkColor properties instead.
April 97 Some change made by MS in the core DLL OLEPRO32 caused the transparancy to stop working under Win95 (not WinNT).
Oct 97 Added the possibility to specify that one corner of a bitmap carries the transparent color, thus eliminating the need to specify the RGB value. This is the recommended way. Also added a predefined picture.
June 98 v1.3 Recompiled with Visual C++ v5

Properties

*Alignment *AutoPictureDisabled BackColor *BackColorDown
*BevelWidth Caption *CornerColor *DarkColor
*DropLength *DropShadow Enabled Font
*Font3D *Font3DDisabled ForeColor *ForeColorDisabled
hWnd *Jam *LightColor MouseIcon
MousePointer *OutlineSize *Picture *PictureDisabled
*PictureDown *PictureFromEdge *Placement *PredefPicture
*ShowFocus *SinkDeep *TransColor *Transparent
*TransStoreMask *Value *WasDblClick

* = The property applies only to VDPush.


Events

Click KeyDown KeyPress KeyUp
MouseDown MouseMove MouseUp

* = The property applies only to VDPush.


Alignment Property

Description
Determines the alignment of the caption text (horizontally and vertically) within the push button.

Remarks
The Alignment property settings are:

Setting Description
0 The caption text appears left-justified at the top.
1 The caption text appears left-justified in the middle.
2 The caption text appears left-justified at the bottom.
3 The caption text appears right-justified at the top.
4 The caption text appears right-justified in the middle.
5 The caption text appears right-justified at the bottom.
6 The caption text appears horizontally centered at the top.
7 The caption text appears horizontally centered in the middle.
8 The caption text appears horizontally centered at the bottom.

Data Type
Integer (enumerated)

Default value
7


AutoPictureDisabled Property

Description
Attempts to automatically give the picture (if any) a "disabled" look when the Enabled property is set to False.

Remarks
The AutoPictureDisabled property settings are:

Setting Description
0 No attempt is made to give any picture a disabled look.
1 The picture's outer contour appears inset on the screen.
2 The picture's outer contour appears raised off the screen.
3 The picture itself appears inset on the screen.
4 The picture itself appears raised the screen.
5 All contours appears inset on the screen. Some contours will be two pixels thick.
6 All contours appears raised off the screen. Some contours will be two pixels thick.
7 All contours appears inset on the screen. Some contours will disappear.
8 All contours appears raised off the screen. Some contours will disappear.

The first four styles (operating on the whole picture) requires the TransColor property to be set to the picture's background color, even if the transparent feature isn't used (this isn't necessary for icons, however).

Data Type
Integer (enumerated)

Default value
3


BackColor Property

Description
Determines the background color of the button.

Remarks
This is the actual surface color of the button, unlike the BackColor property provided by the standard command button. See also CornerColor property.

Data Type
Long

Default value
COLOR_BTNHIGHLIGHT


BackColorDown Property

Description
Determines the background color of the button when the button is depressed.

Data Type
Long

Default value
COLOR_BTNFACE


BevelWidth Property

Description
Sets or returns the width of the bevel along the four sides of the command button to determine the height of the three-dimensional shadow effect.

Remarks
The setting for this property determines the number of pixels used to draw the bevel that surrounds the command button.

Data Type
Integer

Default value
1


Caption Property

Description
The button's caption text.

Remarks
VDPush is able to display several lines of caption text. If the caption text doesn't fit on one line (or if it contains CRLF breaks) it is automatically wrapped onto several lines. A pair of pipe characters (or "vertical bars") may be used instead of CRLF. This makes it possible to create hard line breaks in design mode.

Data Type
String

Default value
Same as the control's name.


CornerColor Property

Description
Determines the color of the corners on the outline.

Remarks
This property is set to black by default which means that the control appears to have sharp edges. To mimic a RoundedCorners property, set CornerColor to the same value as the parent form's background color.

Data Type
Long

Default value
0 (Black)


DarkColor Property

Description
Sets the dark color used to create 3D-effects.

Remarks
By default, this color is dark gray, which goes best with normal, light grey, buttons.

Data Type
Long

Default value
COLOR_BTNSHADOW


DropLength Property

Description
Specifies how deep the button will tend to sink when depressed.

Remarks
This is the number of pixels the caption and picture will be moved right/down when the button is depressed. If DropShadow is True, the picture won't move, but instead get a shadow with the length DropLenght.

Data Type
Integer

Default value
2


DropShadow Property

Description
Creates a drop shadow effect on the picture when the button is depressed.

Remarks
When this feature is in effect, the picture will appear to hang above the button surface when the button is depressed, casting a shadow on the button surface. If the picture is a bitmap, then the TransColor property must also be used.

Data Type
Boolean

Default value
True


Enabled Property

Description
Determines whether the control is enabled or not.

Remarks
The properties Font3DDisabled, ForeColorDisabled, PictureDisabled and AutoPictureDisabled may assist you in presenting an alternate disabled look.

Data Type
Boolean

Default value
True


Font3D Property

Description
Sets or returns the three-dimensional style of the command button caption.

Remarks
The following table lists the Font3D property settings for the 3D command button control:

Setting Description
0 No shading. Caption is displayed flat (not three-dimensional).
1 Raised with light shading. Caption appears raised off the screen.
2 Raised with heavy shading. Caption appears more raised.
3 Inset with light shading. Caption appears inset on the screen.
4 Inset with heavy shading. Caption appears more inset.

Data Type
Integer (enumerated)

Default value
0


Font3DDisabled Property

Description
Determines the 3D style of the caption when the button is in a disabled state.

Remarks
The following table lists the Font3DDisabled property settings for the 3D command button control:

Setting Description
0 No shading. Caption is displayed flat (not three-dimensional).
1 Raised with light shading. Caption appears raised off the screen.
2 Raised with heavy shading. Caption appears more raised.
3 Inset with light shading. Caption appears inset on the screen.
4 Inset with heavy shading. Caption appears more inset.

Data Type
Integer (enumerated)

Default value
3


ForeColorDisabled Property

Description
Determines the caption color when the button is in a disabled state.

Data Type
Long

Default value
COLOR_GRAYTEXT


LightColor Property

Description
Sets the light color used to create 3D-effects.

Data Type
Long

Default value
COLOR_BTNHIGHLIGHT


Jam Property

Description
This property may be used to force the button to be drawn in a specific state (up or down), regardless of any used interaction with it.

Remarks
This property may be used to mimic the behavior of a check button. Just toggle the property value (VDPush1.Jam = VDPush1.JamXor 1) in the Click event. It may also be used to mimic a label or a panel control.

This property does not affect the events the button receives in any way.

Setting Description
0 No, normal.
1 Forced down.
2 Forced up.

Data Type
Integer

Default value
0


OutlineSize Property

Description
Determines the size of the black outline (or border) around the button. Set this property to zero to remove the outline.

Remarks
The pixel size of the black border above and left of the button is calculated as Int( OutlineSize / 2 ) while the pixel size of the border below and right of the control is calculated as Int( ( OutlineSize + 1 ) / 2 ). This makes it possible to have a thicker outline below and right of the button, which is normal for the Win95 user interface.

When the command button has input focus (and ShowFocus isn't turned off), it is drawn as if OutlineSize was increased by 2. This won't, however, affect the interior of the button in any way, i.e. a picture aligned to the left won't move one pixel to the right as it will if you increase OutlineSize by 2 yourself!

Data Type
Integer

Default value
1 (meaning it has a one pixel outline below and right of the button only)


Picture Property

Description
Specifies a bitmap or an icon to display on the command button.

Remarks
The Placement property determines where the picture will be placed with respect to the caption.

Data Type
Picture

Default value
No picture


PictureDisabled Property

Description
Determines the picture to be displayed when the button is disabled.

Remarks
If no picture is assigned to this property, the Picture property is used for the disabled button. The appearence of the picture when the button is disabled may be altered by the AutoPictureDisabled property.

Data Type
Picture

Default value
No picture


PictureDown Property

Description
Determines the picture to be displayed when the button is depressed.

Remarks
If no picture is assigned to this property, the Picture property is used for the depressed button as well.

Data Type
Picture

Default value
No picture


PictureFromEdge Property

Description
Determines the distance between the button's edge and the picture given in pixels.

Remarks
The distance may be a negative number.

Data Type
Integer

Default value
0


Placement Property

Description
Determines the placement of the picture with respect to the caption text.

Remarks
The Placement property settings are:

Setting Description
0 The picture appears horizontally centered at the top of the button and the caption text appears below.
1 The picture appears vertically centered at the left of the button and the caption text appears to the right.
2 The picture appears horizontally centered at the bottom of the button and the caption text appears above.
3 The picture appears vertically centered at the right of the button and the caption text to the left.
4 The picture appears both vertically and horizontally centered and the caption will be drawn on top of the picture if necessary.

Data Type
Integer (enumerated)

Default value
1


PredefPicture Property

Description
Selects one of the predefined pictures.

Remarks
The PredefPicture property settings are:

Setting Description Symbol
0 No predefined picture
1 OK green check-mark symbol
2 Cancel red cross
3 Help yellow question mark
4 Yes green exclamation mark
5 No red "no" symbol
6 Info lower case "i"
7 Trash waste basket
8 Eye eye
9 Zoom magnifying glass
10 Find binoculars
11 New blank paper
12 Update card file
13 Printer printer
14 Properties standard properties symbol

Any picture specified by Picture, PictureDown or PictureDisabled takes precedence over PredefPicture.

Data Type
Integer (enumerated)

Default value
0


ShowFocus Property

Description
Determines whether a focus rectangle shall be drawn when the button gets focus.

Remarks

Setting Description
0 No. The button won't graphically reflect that it has input focus. This may be useful for toolbar buttons etc.
1 Win95. The button will be drawn with an extra one pixel black outline and a focus rectangle near the button's edges when it receives the input focus.
2 Classic. The button will be drawn with an extra one pixel black outline and a focus rectangle around its caption (or picture if it doesn't have a caption) when it receives the input focus.

Data Type
Integer (enumerated)

Default value
1


SinkDeep Property

Description
Draws the button in different style than normal command buttons when pressed.

Remarks
When True, the button will tend to sink below its container surface, rather than to the same level when it's depressed.

Data Type
Integer (enumerated)

Default value
False


TransColor Property

Description
This property is used to make one color of a picture transparent, which means that this particular color is replaced with the button's background color.

Remarks
For this property to have any effect, the Transparent property must be enabled. Instead of using this feature you may consider repainting the picture, since both extra execution time and system resources are needed each time the button is repainted. This property is however useful when the button uses a different background color when in a depressed state (using the BackColorDown property).

Data Type
Long

Default value
0 (Black)


Transparent Property

Description
This property is used to enable tranparency in bitmap pictures.

Remarks
See the TransColor property.

Setting Description
0 No. The picture is opaque.
1 Yes. One of the picture's colors should be treated as transparent. The TransColor property carries the transparent color value.
2 When down. This is useful when the button uses a different background color when down and the picture's background color is the same as the buttons background color in it's "up" state. Since the button color is seldom hard coded to gray anymore, this setting should be considered obsolete.
1 Use UL color. All colors matching the color in the upper left corner of the picture should be treated as transparent.
1 Use UR color. All colors matching the color in the upper right corner of the picture should be treated as transparent.
1 Use LR color. All colors matching the color in the lower right corner of the picture should be treated as transparent.
1 Use LL color. All colors matching the color in the lower left corner of the picture should be treated as transparent.

Data Type
Integer (enumerated)

Default value
0


TransStoreMask Property

Description
This property is used to make VDPush store the transparent bitmap mask used to render transparent bitmaps. It will improve the time used to redraw the button when you use transparent pictures, see Transparent property.

Remarks
The cached bitmap mask is created the first time it is needed. Therefore it doesn't have to be stored in the EXE file.

Data Type
Boolean

Default value
False


Value Property

Description
Setting this property to True will generate a Click event. Reading it will return the current state of the button (if the user is currently holding it down).

Remarks
This is the default property. Note: this property is not in any way affected by the Jam property.

Data Type
Boolean


WasDblClick Property

Description
In the Click event, this property may be used to determine if the Click originated from a DblClick.

Remarks
Command buttons should normally not respond to DblClicks, but this is nevertheless a method to do it.

Data Type
Boolean


Group push buttons

It is possible to use VDPush as a group push button. If you want only one button in a group to be down at the same time, just make a control array out of the buttons of a group and include the following code in the click event:

Sub VDPush1_Click (Index As Integer)
  If Index <> nCurrentButtonDown Then
    VDPush1(Index).Jam = 1
    VDPush1(Index).Refresh
    VDPush1(nCurrentButtonDown).Jam = 0
    nCurrentButtonDown = Index
  End If
End Sub

Also declare this somewhere (in the form or a module):

  Dim nCurrentButtonDown As Integer

You may also want to set the BackColorDown property to &H00E0E0E0& in buttons used as group push buttons.


Migrating DBPush

In order to load a 16-bit VB project using DBPush into the 32-bit environment using VDPush you need to do the following:

  1. Make sure you used the installation program for installing VDGT. The installation program adds a line to the VB.INI file, telling VB that VDGT is the OLE counterpart to DBPush.
  2. Since the control's object name has changed, you'll need to manually update all your .FRM files using a text editor. Do a global search-and-replace, changing all occurrences of:
    1. "Begin DBPush" to "Begin VDPush" (if you're migrating a VB3 form)
    2. "Begin VBX.DBPush" to "Begin VBX.VDPush" (if you're migrating a VB4 project)
  3. Start 32-bit VB, make sure to check the option "Upgrade custom controls" (under Options, Advanced) and then open your old (modified) 16-bit project.
  4. Replace any usage of obsolete properties in the source code.

Templates

In the custom properties dialog box, a tab called "Templates" can be found. Templates may be used to save often used settings to a file and then loading the saved properties to new buttons.

All templates will be stored as separate files with extention ".vpt". The path to the default directory is stored in the registry under "HKEY_LOCAL_MACHINE\ SOFTWARE\Visual Design", value "VDPushTemplates". This is, by default, the directory used to install the documentation and samples.

Currently, picture properties are not supported.


Comparison between VDPush and DBPush properties

VDPush DBPush Comment
Alignment Alignment + VertAlignment Two properties combined into one
AutoPictureDisabled AutoPictureDisabled New default value: 3
BackColor BackColor System color is default value
BackColorDown BackColorDown System color is default value
BevelWidth BevelWidth New default value: 1
Caption Caption No longer the default property
CornerColor CornerColor
DarkColor DarkColor
DropLength (BevelWidth)
DropShadow DropShadow
Enabled Enabled
Font3D Font3D
Font3DDisabled Font3DDisabled New default value: 3
Font FontXXX
ForeColor ForeColor
ForeColorDisabled ForeColorDisabled
hWnd hWnd
Jam ForceDown + ForceUp Two properties combined into one
LightColor LightColor System color is default value
MouseIcon CustomCursor MouseIcon is a "standard" property
MousePointer MousePointer Conforms to the "standard" property
OutlineSize OutlineSize New behavior, see OutlineSize
Picture Picture
PictureDisabled PictureDisabled
PictureDown PictureDown
PictureFromEdge PictureFromEdge
Placement Placement
PredefPicture PredefPicture Several more pictures included
ShowFocus FocusRect Enumerated; no longer a Boolean
SinkDeep Style Elliptical buttons no longer supported
TransColor TransColor
Transparent Transparent Enumerated; no longer a Boolean
TransStoreMask - New property
Value - New property (the default)
WasDblClick WasDblClick Restores to False after Click event

Rev 1998-06-02