Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

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

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…
Most MSPs worth their salt are already offering cybersecurity to their customers. But cybersecurity as a service is wide encompassing and can mean many things.  So where are MSPs falling in this spectrum?
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

829 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