Solved

Using Transform to format grid turns the control to read-only

Posted on 2011-03-16
3
1,069 Views
Last Modified: 2012-06-27
I have a grid which allows only one row as editable, all other rows are readonly with the following code in the AfterRowColChange Procedure

Thisform.grdMyGrid.SetAll([ReadOnly],Alltrim(myfield)<>"Planned POs",[column])
Thisform.grdMyGrid.SetAll([ReadOnly],Alltrim(myfield)<>"Planned POs",[row])

The above code works and only records with the value of myfield = "Planned POs" editable

Howver, trying to format the numeric cells in the grid with the following code (either in the Init or the AfterRowColchange Procedure)

FOR i = 11 TO 41
  STORE FIELD(i) TO myfield
  thisform.grdMyGrid.columns(i).ControlSource= "transform(mytable." + myfield+" ,'@z 999,999')"
NEXT i

The above formating code does in fact format the numeric fields in the grid but turns the whole grid to read only.

Can you provide code on how to format the numeric fields without locking the one row I want to edit?

Thanks
0
Comment
Question by:wheat01
3 Comments
 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 250 total points
ID: 35149556
You can't use the controlsource to format the output, if the controlsource is not a field or variable, this means no way to write back changes to the controlsource and thus renders the control readonly.

Use Textbox properties Format, Inputmask. In This case set Format to 'Z' and Inputmask to '999,999'.

FOR i = 11 TO 41
  STORE FIELD(i) TO myfield
  thisform.grdMyGrid.columns(i).ControlSource= 'mytable.' + myfield
  thisform.grdMyGrid.columns(i).Text1.Format='Z'
  thisform.grdMyGrid.columns(i).Text1.Inputmask='999,999'
NEXT i

Open in new window


Bye, Olaf.
0
 
LVL 41

Expert Comment

by:pcelba
ID: 35149672
Yes, it could work. Just two notes:

1) You may assign Format and InputMask directly to the columns(i)

2) Thisform.grdMyGrid.SetAll([ReadOnly],Alltrim(myfield)<>"Planned POs",[row])
does nothing because Grid has no "row" object inside.
0
 

Author Closing Comment

by:wheat01
ID: 35150843
Thanks, worked first time.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert Word Doc or PDF file to VFP FRX report 9 1,877
How to fix orphan DBF 9 643
Toolbar in a formset deletion 1 299
SQL Server CE 2.0 databases on desktop using ADO / OLE DB / VFP 8 59
Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question