Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unexpected text box behavior

Status
Not open for further replies.

qlark

Programmer
Jan 5, 2006
54
0
0
CA
Just put a VFP 9.0 base class text box on a form and have run into two unexpected results;

1) entering .01 as a default value is automatcally changed to 0 ... I gather this object is autoformatting the contents but I don't see a property that can stipulate a format

2) changing the backcolor doesn't seem to have any effect on the color of the box ... I was expecting the color to chamge

 
Enter 0.01 as default value
I see no problems changing the Back and/or fore color of the TextBox.

Borislav Borissov
 
Thanx but what if I don't want 0.01 ... isn't there any way to specify this default as a string value? ... in EXCEL adding a special character '.01 overrides the auto "type"

I assume that this value is being passed as a VARIANT which is at some point being interpreted as a NUMBER and defaulting to INTEGER or LONG?

When I run a procedure with textbox1.value = ".01" I get the desired result but this is because I have explicitly passed it a string.

As for the Backcolor ... two things I found are effecting when the colors are active;

1) ENABLED = TRUE/FALSE (requres setting the DISABLEDBACKCOLOR)

2) BACKSTYLE = 0/1 (TRANSPARENT/OPAQUE)
 
You could put the following in the Value property of the textbox...

=".01"

boyd.gif

SweetPotato Software Website
My Blog
 

Qlark,

isn't there any way to specify this default as a string value?

The default value of a textbox is a string value. It will be something other than a string if (a) you have stored a non-string value in it, or (b) it has control source to a field that contains a non-string value.

For (b), you're out of luck -- you'll have to change the control source. For (a), you can change it back to a string by doing THIS.Value = "".

If that still doesn't give the desired result, check that the InputMask and Format properties are empty.

As for the BackColor ... of course, Enabled and BackStyle will affect this. And so will ReadOnly. What exactly are you trying to achieve?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Nothing to fancy ... just a fixed array of static labels that can change color randomly on specific events ... I choose to use texboxes even though a label object could have been used. Basically getting the feel back for FOX after being away for too many years.

Craigsboyd's post does work ... by adding an "=" in the property, the value can be forced to accept a string type.

Thanx for the responses.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top