Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add column to grid textbox is readonly
Message
 
 
To
26/01/2004 11:55:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00870614
Message ID:
00870839
Views:
11
Hi Tracy,

It's important to specify table alias before the field. In some cases, if you don't specify table name, e.g. TableName.field and do field instead, the grid's control turns read-only. We found this problem with my colleague, when her grid suddendly started to exibit this behavior.

Good luck!

>In VFP8 SP1 we have a baseform that is used and it contains some custom methods. When a form is created off this baseform, sometimes a generic VFP grid is dropped onto it. We have been using the below code to populate the grid on the form on the fly programmatically in runtime successfully. However, up to this point all of the grids have been readonly for browsing purposes only. Now we need to be able to edit some of the textboxes in the grid, but the problem that is ocurring is that after the code below is run in the form's init all of the textboxes in the grid end up as readonly = .T.. Even if we turn around and set the control to readonly = .F. it is still .T. when the form opens. Any ideas? No other property ends up as readonly, only the textboxes for some reason and we can't seem to stop it.
>
>TIA,
>Tracy
>
>
>*--Form init which populates the grid
>DODEFAULT()
>
>thisform.setgridsource('insured')
>thisform.cleargridfields
>
>thisform.addgridfield(1, 'insured.po_name', 30, 'Name', '')
>thisform.addgridfield(2, 'accounts.po_acct', 15, 'Account#', '')
>thisform.addgridfield(3, 'accounts.po_pmt', 13, 'Payment', '@z 9,999,999.99')
>thisform.addgridfield(4, 'accounts.po_due', 12, 'Due Date', '')
>thisform.addgridfield(5, 'accounts.po_pmtdat', 12, 'Last Pmt', '')
>thisform.addgridfield(6, 'insured.po_sysnum', 10, 'Profile#', '9999999999')
>
>thisform.caption = "PREMIUM FINANCE ACCOUNTS WITH: "+xcomname
>
>
>
>
>*--addgridfield method of baseform
>LPARAMETERS nColIndex, cField, iWidth, cHeading, cMask
>*---Add a Column to the grid
>
>IF TYPE('thisform.currentgrid') = 'O'
>
>  WITH thisform.currentgrid
>
>    .AddColumn(nColIndex)
>    .Columns(nColIndex).ControlSource = cField
>    .Columns(nColIndex).Width = (( FONTMETRIC(6, 'Arial', 9) + 2) * iWidth )
>
>    *---Remove default header and create a custom header
>    *---so when can get to the header.click event.
>
>    .Columns(nColIndex).RemoveObject('Header1')
>    .Columns(nColIndex).NewObject('custHeader1', 'custHeader', 'custHeader.prg')
>    .Columns(nColIndex).custHeader1.caption = cHeading
>	
>    IF !EMPTY(cMask)
>	.Columns(nColIndex).InputMask = cMask
>    ENDIF
>	
>  ENDWITH
>
>ENDIF
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform