ID: Q147787
3.00 3.00b WINDOWS kbtool kbhowto
The information in this article applies to:
This article shows you how to make a builder that adds an instance of the VCR class to your form allowing the user to customize it with the .ico files that come with the Professional version of Visual FoxPro.
The following procedure creates a builder that uses a graphical option- group control to allow the user to pick a navigation button style. After the user selects a style, the builder creates an instance of the VCR class on the form. The VCR class is in the Buttons.vcx file located in the Vfp\Samples\Controls directory.
Make sure that you've completed a full installation of the Professional edition before using the following procedure to create the builder.
1. Type the following command in the Command window to create a form class,
and modify it in the Visual Class Designer:
CREATE CLASS navbutton AS form OF nvbuild.vcx
2. Set the following properties for the class:
Property Value
---------------------------------------
BackColor 192,192,192
Height 250
Left 260
Top 144
Caption Navigation Button Builder
MinButton .F.
MaxButton .F.
Width 375
WindowType 1-Modal
3. Add an OptionGroup control to the form, and set the following
properties:
Property Value
-------------------
ButtonCount 9
Height 148
Left 15
Top 17
Width 148
4. From the properties sheet, select Option1, and set the following
properties. Repeat this step for Option2, Option3, Option4, Option5,
Option6, Option7, Option8 and Option9.
Property Value
------------------------
Caption
Style 1-Graphical
Height 44
Width 44
5. From the properties sheet, select the following objects and set their
properties to the indicated value. All of the .ico files are located in
the Samples\Graphics\Icons\Arrows directory off the main Visual FoxPro
directory.
Property Value
------------------------
Option1
Left 5
Top 5
Picture arw01rt.ico
Option2
Left 52
Top 5
Picture arw03rt.ico
Option3
Left 99
Top 5
Picture arw06rt.ico
Option4
Left: 5
Top: 51
Picture arw02rt.ico
Option5
Left 52
Top 51
Picture: arw05rt.ico
Option6
Left 99
Top 51
Picture arw07rt.ico
Option7
Left 5
Top 98
Picture arw04rt.ico
Option8
Left 52
Top 98
Picture arw08rt.ico
Option9
Left 99
Top 98
Picture point04.ico
6. Add a command button to the form, and set its caption to OK. Add the
following code to its Click event:
SET CLASSLIB TO SYS(2004)-"samples\controls\buttons.vcx" ADDITIVE
DO CASE
CASE THISFORM.OptionGroup1.Value = 1
THISFORM.Tag=SYS(2004)-"samples\graphics\ICONS\ARROWS\ARW01"
CASE THISFORM.OptionGroup1.Value = 2
THISFORM.Tag=SYS(2004)-"samples\graphics\ICONS\ARROWS\ARW03"
CASE THISFORM.OptionGroup1.Value = 3
THISFORM.Tag=SYS(2004)-"samples\graphics\ICONS\ARROWS\ARW06"
CASE THISFORM.OptionGroup1.Value = 4
THISFORM.Tag=SYS(2004)-"samples\graphics\ICONS\ARROWS\ARW02"
CASE THISFORM.OptionGroup1.Value = 5
THISFORM.Tag=SYS(2004)-"samples\graphics\ICONS\ARROWS\ARW05"
CASE THISFORM.OptionGroup1.Value = 6
THISFORM.Tag=SYS(2004)-"samples\graphics\ICONS\ARROWS\ARW07"
CASE THISFORM.OptionGroup1.Value = 7
THISFORM.Tag=SYS(2004)-"samples\graphics\ICONS\ARROWS\ARW04"
CASE THISFORM.OptionGroup1.Value = 8
THISFORM.Tag=SYS(2004)-"samples\graphics\ICONS\ARROWS\ARW08"
CASE THISFORM.OptionGroup1.Value = 9
THISFORM.Tag=SYS(2004)-"samples\graphics\ICONS\ARROWS\POINT"
ENDCASE
= ASELOBJ(aContainer,1)
aContainer[1].ADDOBJECT("Myvcr","vcr")
aContainer[1].Myvcr.Height=40
aContainer[1].Myvcr.Width=185
* Up button
aContainer[1].Myvcr.cmdTop.Height=40
aContainer[1].Myvcr.cmdTop.Width=40
aContainer[1].Myvcr.cmdTop.Caption=""
aContainer[1].Myvcr.cmdTop.picture = ThisForm.Tag- ;
IIF(RIGHT(ThisForm.Tag,5)="POINT","05","UP")-".ICO"
* Left button
aContainer[1].Myvcr.cmdPrior.Height=40
aContainer[1].Myvcr.cmdPrior.Width=40
aContainer[1].Myvcr.cmdPrior.Caption=""
aContainer[1].Myvcr.cmdPrior.picture = ThisForm.Tag- ;
IIF(RIGHT(ThisForm.Tag,5)="POINT","02","LT")-".ICO"
* Right button
aContainer[1].Myvcr.cmdNext.Height=40
aContainer[1].Myvcr.cmdNext.Width=40
aContainer[1].Myvcr.cmdNext.Caption=""
aContainer[1].Myvcr.cmdNext.picture = ThisForm.Tag- ;
IIF(RIGHT(ThisForm.Tag,5)="POINT","04","RT")-".ICO"
* Down button
aContainer[1].Myvcr.cmdBottom.Height=40
aContainer[1].Myvcr.cmdBottom.Width=40
aContainer[1].Myvcr.cmdBottom.Caption=""
aContainer[1].Myvcr.cmdBottom.picture = ThisForm.Tag- ;
IIF(RIGHT(ThisForm.Tag,5)="POINT","03","DN")-".ICO"
THISFORM.Release
7. Add another command button to the form, and set its caption to Cancel.
Add the following command to its Click event:
THISFORM.Release
8. Add the following command to the Init event of the form:
PARAMETERS uP1,uP2,uP3
9. Save the class. To register this builder, add a new record to the
Builder.dbf table located in the Wizards directory, and enter the
following values into the appropriate fields:
NAME Navigation Button Builder
DESCRIPT Applies a set of customized navigation buttons onto a form
TYPE FORM
CLASSLIB NVBUILD.VCX
CLASSNAME NAVBUTTON
10. Copy Nvzbuild.vcx and Nvbuild.vct to the Wizards directory.
To use the builder, create a new form, and then either:
-or-
Additional reference words: 3.00 3.00b VFoxWin KBCategory: kbtool kbhowto KBSubcategory: FxtoolBuilder
Keywords : kbcode FxtoolBuilder
Version : 3.00 3.00b
Platform : WINDOWS
Last Reviewed: May 22, 1998