Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid & Memo and other problems...
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00227549
Message ID:
00228153
Views:
26
Hi Bruce,

I still have the problem - now my grid appears blank. May be I need to forget about this idea? :)

>The column.controlsource is the correct place for it. If the column is readonly, it will work, I guarantee it :)

Let's see the whole code in Grid Init method:

LOCAL lnWidth, lcCaption
dodefault()
*--- Set to 0 (zero) so when addcolumn occurs the columncount is correct.
This.columncount = 0

*--- Array of fields and order to display in grid.
DIMENSION lafieldlist[23]
lafieldlist[1]="bldmstr.adcpstreet"
lafieldlist[2]="bldmstr.pstreet"
lafieldlist[3]="bldmstr.adcostreet"
lafieldlist[4]="bldmstr.ostreet"
lafieldlist[5]="bldmstr.adcnames"
lafieldlist[6]="bldmstr.fullname1"
lafieldlist[7]="bldmstr.fullname2"
lafieldlist[8]="bldmstr.adcdesc"
*lafieldlist[9]="bldmstr.notes"
lafieldlist[9]="bldmstr.stateuse"
lafieldlist[10]="bldmstr.lotsize"
lafieldlist[11]="bldmstr.numbldgs"
lafieldlist[12]="bldmstr.buildstyle"
lafieldlist[13]="bldmstr.grbldgarea"
lafieldlist[14]="bldmstr.livarea"
lafieldlist[15]="bldmstr.basmntarea"
lafieldlist[16]="bldmstr.numfloors"
lafieldlist[17]="bldmstr.numfirepl"
lafieldlist[18]="bldmstr.yearbuilt"
lafieldlist[19]="bldmstr.totrooms"
lafieldlist[20]="bldmstr.bedrooms"
lafieldlist[21]="bldmstr.bathrooms"
lafieldlist[22]="bldmstr.halfbaths"
lafieldlist[23]="bldmstr.propid"

*--- Walk through array adding columns, headers and controlsource's to grid.
FOR i=1 TO ALEN(lafieldlist,1)
This.addcolumn(This.columncount+1) && Add column to the end
lcCaption=Proper(SUBSTR(lafieldlist[i],AT(".",lafieldlist[i])+1))

if TYPE(lafieldlist[i])="L"
lbValue=&lafieldlist[i]
=messagebox (iif(lbValue,"Yes","No"))
This.columns(i).controlsource=IIF(lbValue,'N','Y')
else
This.columns(i).controlsource = lafieldlist[i] && Assign controlsource
endif

if left(lcCaption,3)="Adc"
lcCaption=UPPER(substr(lcCaption,4,1))
endif

lnWidth=fsize(lcCaption)
lnWidth=iif(lnWidth>30,lnWidth-24,lnWidth)
lnWidth=MAX(lnWidth,len(lcCaption) ) * THIS.FONTSIZE
This.columns(i).header1.caption = lcCaption && Add header
This.columns(i).width= lnWidth

ENDFOR
this.readonly=.t.



>>And I am not pretty confident that I can use this code either, because I want to show Y/N for all my grid rows, so I am afraid I can not put this code into Init method, I need to put it in AfterRowColChange - so, loop for all my columns, it becames more complex... May be I need to forget this idea at all...
>
>It's really quite simple, you can do it in the init, but you may want to forget trying to use a loop to assign controlsources, just assign them line by line, if it gets too tricky. Or maybe you can condition it on "logical" type in the loop? Anyway, you can try the basic idea in a little test grid and see that it works, to give you confidence :)

It still doesn't work... So, I didn't receive confidence :)
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