Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add column to grid textbox is readonly
Message
From
26/01/2004 14:57:15
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
26/01/2004 11:55:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00870614
Message ID:
00870738
Views:
12
Hadn't tried it in VFP8, but in VFP7 setting the column visible had to be done once the column.init finishes - so somewhere around the last lines of your .addgridfield() method would be OK.

Another thing to consider - how many columns does the grid have before you do this, and do you set the recordsource? What worked for me is:
- set the recordsource
- set the .Columncount=0 to kill the default columns - grid is automatically rebuilt when a recordsource is set
- .newobject("myColumnName", "column") - I actually had my own prg-based columns here
- .colMyColumnName.Visible=.t.

>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
>

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform