In VFP to achieve with the combination of variant and an oval frame graphics menu
Currently, Visual foxpro applications in the database has been the development of a wide range of applications, systems development skills and attention to a matter of attention, this article both Syria and the programming skills, to achieve a very simple, but in practical applications has played a very good role.
1. Combo box with the variant
In the practical application of systems, often using the drop-down list box to achieve the standardization of characters in input field data and often there will be a data table more than this kind of data fields, and the corresponding field of standardization of these data as an enumeration data enumeration in a unified data management table. This is a problem of the enumeration corresponding to different data fields have a narrow width, in order to saved all of these data, enumeration data table to the data fields wide enough, but the target database control field, it is clear to of data based on business requirements and space-saving considerations, will be designed to fit the field width. Of VFP, if beyond the control of the width of a list of data field width, the text box can not show the selected data, which programmers often ignored, resulting to the user's program can not function properly. In fact, as long as the drop-down list box in the design of a few lines of code when a little will be able to resolve this problem, and also the realization of the drop-down list box and text box control automatically follow changes in the width of the field, so that the width of the object is always consistent with the field width .
Assuming control of the control data table field KZB.DBF called A1, the practical application of the system, A1 is equivalent to the different data tables in different field enumeration. Table MJB.DBF will enumerate all the applications enumerated data management, including enumeration forms at least two fields: field enumeration enumeration data and signs, the enumeration data fields here called CC, enumeration Fields marked as MJBZ. Figure 1 for the control of Table A1 field width of 10 cases, Figure 2 for the control of Table A1 field width modulation for the case of 26. Specific method is: first the data in the form to add the control environment and enumerated in table form, in the Init Event of the combo box to add the following method code:
KD = LEN (KZB.A1)
THIS.WIDTH = 31 +6.3 * KD
CREAT CURSOR LS (CC c (KD))
APPE FROM MJB FOR MJBZ = "test"
& & The completion of the enumeration field data should be screened.
General a system of enumeration enumeration data field a few hundred total, however, create the cursor in the INIT will not affect the speed. In the design of the list, the combo box to the standard write cursor RowSource Department of LS, the realization of this function increases only very little code to write, but in practical applications has played a good role.
2. Ellipse graphics menu
In the application system, commonly used as a large button on the Start button subsystem, vfp the button is generally rectangular, oval produced here a graphical method of button-up menu.
Methods: first fill in the form of VFP plus graphics control SHAPE, the key is to SHAPE the Curvature attribute value is set to 99, which will allow control by the rectangular shape into a round or oval. After BackStyler of SHAPE is set to "0, transparent", BorderWidth property to the appropriate width, such as 2 ~ 3, so that the graphics on the bottom can be a good fit with its oval graphics BorderColor attribute the appropriate color set, other attributes set by default values. This, we designed a transparent oval graphics, aim is to use it to simulate a button click on an oval inside the achievement CLICK event, click on its external CLICK incident does not occur. The next step was to ellipse graphics in an appropriate place the following picture, pictures, and an oval shape to the same graphics, the same used to fill additional way to mark a control increases the control picture Picture, picture BackStyler set to "0, transparent", and then Picture Properties settings in the image file name. Adjust the picture position, so that graphics and pictures oval with the overall sense. In order to simulate the action CLICK button, we use elliptic methods MouseDown Event graphics, plus filling in the following code:
LPARAMETERS nButton, nShift, nXCoord, nYCoord
H = THIS.LEFT + THIS.WIDTH / 2
K = THIS.TOP + THIS.HEIGHT / 2
A = THIS.WIDTH / 2
B = THIS.HEIGHT / 2
y1 = kb * SQRT (1 - (nXCoord-h) ^ 2 / (a ^ 2))
y2 = k + b * SQRT (1 - (nXCoord-h) ^ 2 / (a ^ 2))
IF nYCoord> Y1.AND.nYCoord <Y2
THIS.PARENT.LABEL5.VISIBLE =. T.
& & Points within ellipse
THIS.PARENT.LABEL6.VISIBLE =. F.
& & Points outside oval
* DO FORM SUBFORM1
& & Lower form
THIS.PARENT.LABEL5.VISIBLE =. F.
THIS.PARENT.LABEL6.VISIBLE =. T.
When clicking with the mouse inside an oval, the form displayed at the bottom "of the button you point the internal"; click on the external elliptical, the form displayed at the bottom "You point the external button." This code can click the left mouse button to activate the function of the lower form, the form in order to ensure reliable operation, it would be preferable to attribute the main form WindowType set to "1 - model."
Form more than in the Lenovo machine debugging through P5/133.
Visual FoxPro Tutorial Articles
- VFP edit box method for automatic correction
- Visual FoxPro 9.0 is more powerful
- Dbf of how to use VFP to SQL Server 7.0 Distributed Query
- VFP the secondary development of smart sensors
- The contents of two databases on the output HTML format methods
- FoxWeb line with the rapid release of your database FOXPRO
- In Chinese and English to achieve VFP5.0 automatically switch
- In VFP to achieve with the combination of variant and an oval frame graphics menu
- Programmed to run through a dial-up network connection
- VFP to achieve in your browser to run the application method
- Visual FoxPro Application for increase in file compression
- Animation of simulation in the VFP
- Using Visual FoxPro 5.0 design data file structure browser
- VFP table tracking method
- In VFP print statements to achieve the specified number of records per page
- Procedures to allow VFP to run in a browser
- Visual FoxPro how to add and remove the network connection
- VFP and SQL SERVER like to do with C / S system
- OK karaoke subtitles colored dynamic display
- In a networked environment using Foxpro database management software developed under the Experience
Can't Find What You're Looking For?
Rating: Not yet rated