Thursday, July 23, 2015

VFP small tricks

1. Control text format in Textbox and other input controls

InputMask Property
Specifies how users enter data and how to display data in a control. Available at design time and run time.

Format Property
Specifies the input and output formatting of a control's Value property. Available at design time and run time.


2. Move cursor to the right in a textbox

This.SelStart = LEN(ALLTRIM(This.Value))
This.SelLength = 0



3. Multiple forms - Modal vs Modeless

 Modal forms require user input. A modal form has exclusive focus until it is dismissed. When showing a modal form, the controls outside the modal form will not react until the modal form is closed.
http://fox.wikis.com/wc.dll?Wiki~ModalvsModeless

The property "Desktop" of child form specifies whether a form can appear anywhere on the Windows desktop (if the value is .T.) or is contained in the parent form ( if the value is .F.). The default value is .F.

4. Prevents Visual FoxPro from inserting a key press into the keyboard buffer

Including NODEFAULT in the KeyPress event procedure or function prevents Visual FoxPro from inserting the key press into the Visual FoxPro keyboard buffer. Therefore, you can create a KeyPress procedure so that you can test which key is pressed before the key is sent to the keyboard buffer.
https://msdn.microsoft.com/en-US/library/e525z4k3(v=vs.80).aspx


5. Print immediately

Put these two lines at the end of program:

SET PRINTER TO
SET DEVICE TO SCREEN

No comments:

Post a Comment