Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create myheader for a grid?
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00194255
Message ID:
00194776
Views:
16
Jeff,

It's not a dumb question at all, not being able to visually design using subclasses for Column, Header, Page, OptionButton is a big hinderance in VFP. You can leave the the default BaseClass objects in their container and "visually" design them. Then at runtime you yank those objects out and stuff your subclass in:
loTempHeader = createobject( "header" )
for each loColumn in this.Columns
   loHeader = loColumn.Header1
   with loTempHeader
      .Caption = loHeader.Caption
      .FontName = loHeader.FontName
      ...
   endwith
   loHeader = .null.
   loColumn.RemoveObject( "Header1" )
   loColumn.AddObject( "Header1", "MyHeaderClass" )
   loHeader = loColumn.Header1
   with loHeader
      .Caption = loTempHeader.Caption
      .FontName = loTempHeader.FontName
      ...
   endwith
   
endfor
>I'm beginning to feel really dumb here. Let prove it by explaining a little more
>
>I've got this Grid class I call memgrid. This memgrid will allow the user to resize and move coloumn around and remember where and size the next time the program is run. If this grid has a recordtype 4 (SQL statement) I have in place a way for them to double click the header and this refreshes the grid orderby that coloum.
>
>What I currently do is code each double click of the header after I run my builder on it. I wanted to have the builder add this code to the double click of each column if the recordsource type was 4. It currently works but only untill I close the form that has had the header added from the builder. If I open the form up in dev mode it says it can't find myheader. I understand that, I've not added it to the project, I have never worked with programic classes before. Everything up till now I've done with the Visual Class builder. The header is not a Visual Object.
>
>So please---after you've quit laughing---can you show me the way to have my memgrid stay a visual class and have my builder change the header double click if the recordsource is type 4.
>
>I can't figure out how to add this define class prg into my memgrid class. I would like to have the memgrid be able to be dropped on the form, fill in the recordsource, and have the builder take care of the rest.
>
>Can it be done.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform