A BackSpace key Problem in FoxPro

Your customer and final user, is using by first time your application, write, add records, edit it, process data, etc. In a unafortunate moment, he need clear the content of ONE field (in a TextBox control) in the current form. When he begin to clear the field, using the backspace key; and comes to start of field, the cursor leap in a previous field and he look that, not only is cleared the required field value!, this also clear other fields!. Your user try undo it, but he can not do it. Then, a famous question is  ask you: Because this problem in you application?. You do'nt can say: "BECAUSE IT WAS MADE WITH VFP!"

This is a Old problem (o will be a feature?) in FoxPro and D-Base Applications, that work with TextBox Control. You have a set of fields in your form and press many, many, the backspace key in the last field, then you look at it, and you have a new and clear form.

To resolve the problem, in your TextBox base class, add the following code in the KeyPress Method:

LPARAMETERS nKeyCode, nShiftAltCtrl

*-- Control when you are using a mask input
lCondicion = .F.
nSelStart= This.SelStart 

*-- This is a validation when you are using a 
*-- Formatted Control
IF TYPE("This.Value")="C" AND nSelStart>0
	*-- Obtains the control current value
	cValue1 = ALLTRIM(SUBSTR(This.Value,1,nSelStart))
	
	nLen = LEN(cValue1)
	
	*-- Get a Empty Formatted value using the Control Input Mask
	cValue2 = ALLTRIM(TRANSFORM(SPACE(nLen),This.InputMask))
	
	*-- If the Empty Formatted value is equals to
	*-- control current value, you also need apply the feature!
	lCondicion = (cValue1 == cValue2)
ENDIF 

*-- If you're in the real selection start of value and
*-- the pressed key was the Backspace Key {127}, remove the key from buffer
IF (nSelStart<1 OR lCondicion) AND nKeyCode=127
	NODEFAULT 
ENDIF

Now, run your form and press the backspace key. When the cursor comes to the begin of your control, it does not leap to another text controls.

This code is valid for TexBox and ComboBox Controls. The problem has been not detected in the EditBox Control.

Microsoft Visual FoxPro Sedna March CTP is now available!

In the last month end, the Microsoft Visual FoxPro Team has released the first download for the "Sedna" Preview, this is a group of features that will be avaiable in the next version of Visual FoxPro. This is a cool implementation of .NET 2.0 features in a component called NET4COM.

The Sedna Feature Overview documents are also avaiable and includes all this new features (they were released before).

The announce was made by Milind Lele, VS Data PM in his blog on http://blogs.msdn.com/vsdata.

For more information about VFP future visit http://msdn.microsoft.com/vfoxpro/roadmap .

Regards!

Showing the installed printers, using object Windows Scripting Host

In FoxPro is possible to be made many things, and thanks to it, we can remove to him to benefit to component external, such as COM Objects, or own Windows components, as it is the case of the Windows Scripting Host.  It is possible that with function APRINTERS, we obtain but data that the one that has been obtained in this routine, but this it was a small example that if we removed benefit of everything we will be but productive.

Here the Example:

*/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/ ShowPrinterswithWSH.prg
*/
*/ This is a routine that shows the ;
   printers installed in the computer,;
 
 only using the Windows Scripting Host, ;
   without the necessity to use the native ;
   function APRINTERS of Visual FoxPro.
*/
*/ Author: Ronald Ramirez
*/ Creation Date: June, 2003
*/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCAL wshNetwork As "WScript.Network" &&WshNetwork
LOCAL Printers As Object &&WshCollection
LOCAL i As Integer

wshNetwork = CreateObject("WScript.Network")
Printers = wshNetwork.EnumPrinterConnections

For i = 1 To Printers.Count - 1 Step 2
    ? "Printer Name: "
    ?? Printers.Item(i)
    ? "Port: "
    ?? Printers.Item(i - 1)
Endfor

? "Total of Installed Printers: "
?? INT(Printers.Count / 2)

Printers = .null.
wshNetwork = .null.

*/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Regards!

It updates your TaskPane

Yes, now you can refresh the content of the FoxPro TaskPane, from the following site: http://www.TaskPane.com, here you found XML Panes to download and install into own TaskPane.

The Visual FoxPro, is a feature to Visual FoxPro from your 8.0 version, and is the elegant and pretty tool and add-in to Visual FoxPro.

Now you can obtain very information from RSS, XML Web Services, XML, etc. through of the TaskPane of Visual FoxPro.

Excellent, right?

Regards!