Solved

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

Posted on 2011-03-16
3
1,037 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks, worked first time.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
A procedure for exporting installed hotfix details of remote computers using powershell
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now