Solved

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

Posted on 2011-03-16
3
1,052 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Import CSV Files 5 1,097
SQLite with C# using SQLiteWrapper 3 655
MS Access no longer ablle to link to FoxPro tables 30 303
Foxpro 64bit decoding 8 148
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…
What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

20 Experts available now in Live!

Get 1:1 Help Now