Raig,
I think this is what you want

Sorry about the wordwrap if it happens

Dave Crozier

************
* Start Code
*
oForm=CreateObject("clsForm")
oForm.Visible=.T.

Read events
*
Return


Define class clsForm as Form

  Procedure Load()
    Create Cursor curTest (PK I, ID C(10))
        Insert Into curTest (PK, Id) Values (1, "A01")
        Insert Into curTest (PK, Id) Values (2, "A02")
        Insert Into curTest (PK, Id) Values (3, "A03")
        Insert Into curTest (PK, Id) Values (4, "A04")
        Insert Into curTest (PK, Id) Values (5, "A05")
        
        Select curTest
        Goto top
        *
  Endproc
  
  Procedure init()
    *
        With This
          .AddObject("oGrid","clsGrid")
          With .oGrid
                .Visible=.T.
             .Recordsource="curTest"
             .Columncount=2
             *
           Endwith
           *
        Endwith
        *
  Endproc
  
  Procedure unload()
    Clear Events
  Endproc
   
Enddefine


*********
* The Grid
*   
Define Class clsGrid as Grid
  *
   Columncount=1
   
   Procedure Init()
        With This
                .AddObject("oColumn","clsColumn")
                With .oColumn
                        .Header1.Caption="Hello"
                        .Visible=.T.
                Endwith
                *
        Endwith
        *
   Endproc
   *
Enddefine


Define Class clsColumn as Column
DynamicForecolor="Iif(.T.,Rgb(0,255,0),Rgb(0,0,255))"

        Procedure Init
                With this
                        .AddObject("oLabCont","clsLabCont")
                .CurrentControl="oLabCont"
                .Sparse=.F.
                Endwith
                *
        Endproc
        *
enddefine


********
* The label Container
*
Define Class clsLabCont as Container
Backstyle=1

  Procedure Backstyle_Access()
        This.lblLabel.Caption=Evaluate("curTest->Id")
        DoDefault()
        Return This.BackStyle
  Endproc
  
  Procedure init()
        With This
                .AddObject("lblLabel", "Label")
                With .lblLabel
                        .Visible=.T.
                        .Top=0
                        .Left=0
                        .Caption="Hello"
                        .BackStyle=1
                        .Backcolor=Rgb(255,0,0)
                Endwith
                *
        Endwith
        *
Enddefine
*
* End Code
*******
    

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Paul Newton
Sent: 07 June 2007 10:21
To: profox@leafe.com
Subject: Faking it - ControlSource

Hi all

I have a grid and in one column I need to put a control which does not 
have a native controlsource property.  The column needs to have have 
sparse set to .F. and each row in this column should have a 
display/value dictated by a value from a table whci is the recordsource 
for the grid.

The simplest example might be that the control is a label and I need its 
caption to be "bound" to the recordsource.  Another example might be a 
container whose contained objects need to have properties bound to the 
recordsource. 

A third example might (?) be an ActiveX control (NOT oleBound) that I 
want to behave like an olebound control - although I don't need this 
right now.

Can something like this be done ?

Thanks

Paul Newton




[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to