Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Different behaviour of VFP by changing gridheader in for
Message
From
26/02/2003 10:13:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/02/2003 09:57:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00758071
Message ID:
00758094
Views:
21
>Hi all,
>
>I am having a problem with changing a grid-header. Until now I did it just the way it is described in FAQ 7967 and the grid is part of a regular form.
>Now I have put this form into a class and fox says 'Header1 cannot be created'. It seems, that the original Header1 is not removed correctly anymore.
>
>What's wrong?
>
>
>This is the code I am using:
>
>* code of grid1.init
>with this
> for liZaehler = 1 to .columncount
> for liZaehlHilf = 1 to .columns(liZaehler).controlcount
> if inlist(lower(.columns(liZaehler).controls(liZaehlHilf).class),'header','cheader')
> lcCaption = .columns(liZaehler).controls(liZaehlHilf).caption
> lcHeaderName = alltrim(.columns(liZaehler).controls(liZaehlHilf).name)
> endif
> endfor
> if pemstatus(.columns(liZaehler),lcHeaderName,5)
> .columns(liZaehler).removeobject(lcHeaderName)
> .columns(liZaehler).addobject(lcHeaderName,'cHeader')
> .columns(liZaehler).&lcHeaderName..caption = lcCaption
> .columns(liZaehler).&lcHeaderName..name = lcHeaderName
> endif
> endfor
>endwith
>
>* code of m_class.prg used with 'set procedure to m_class additive'
>define class cheader as header
> name = 'cHeader'
> proc DblClick
> this.parent.parent.header_click(this)
> endproc
> proc RightClick
> this.parent.parent.header_rightclick(this)
> endproc
>ENDDEFINE

I don't know what FAQ says but it's simple :
with oCol
    .AddObject("MyHeader","myHeaderClass")
endwith
You don't even need to removeobject('Header1') since a column could only have one header.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform