Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unbound Textbox in grid
Message
From
29/01/2003 15:59:15
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Unbound Textbox in grid
Miscellaneous
Thread ID:
00746878
Message ID:
00746878
Views:
74
All,

We use the the metric system to store our data. Weights are stored in kilograms.

Some information from the US still only comes in the imperial system. Therefore I have been trying to provide a column in a grid showing the weight in pounds. (Yes we do data entry in grids - have for years). It will be next to column for weight in kilos.

The source for the data is wtkgs * 2.205. In a form it is easy. I use a unbounded textbox and calculate the value (wtkgs * 2.205) in the Refresh method. If the user enters a new weight in pounds I catch the change in the valid method. I calculate the wt in kgs and enter it into the wtkgs field.

(The weight in pounds is not stored in the table. This would seem to be trouble since it is the same information, just in different units. Someday they will not be the same and we will not know which is correct.)

I tried the same in a textbox in a grid.

First Try :
procedure Init (for textbox)
oColumn = this.Parent
oColumn.ControlSource = "wtkgs"
oColumn.Bound = .f.
oColumn.Sparse = .t.
this.ControlSource = ""
this.cControlSource = "wtkgs"

Procedure Refresh
this.Value = eval(this.cControlSource) * 2.205

procedure Valid
replace (this.cControlSource) with this.Value / 2.205

This showed the weight in kgs in both columns unless the weight in pounds column has the focus, then only the row that has focus shows the weight in pounds.

Second Try :
procedure Init (for textbox)
oColumn = this.Parent
oColumn.ControlSource = ""
oColumn.Bound = .f.
oColumn.Sparse = .f.
this.ControlSource = ""
this.cControlSource = "wtkgs"

Refresh & Valid remain the same

This showed blanks in the weight in pounds column.

Same thing happened setting :

oColumn.ControlSource = "wtkgs" and oColumn.Sparse = .f.

I am now at a loss to continue. Can anyone help point me on the way.
Best Regards
Don Simpson
Next
Reply
Map
View

Click here to load this message in the networking platform