INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Grids

How to use DynamicCurrentControl in a grid (programmaticaly) by mgagnon
Posted: 20 May 02 (Edited 30 Apr 03)


oForm=Createobject("myForm")
oForm.AddObject('myGrid1','myGrid')
oForm.myGrid1.column1.header1.Caption = "Name"
oForm.myGrid1.column2.header1.Caption = "Color"
oForm.myGrid1.column2.Sparse = .F.
oForm.myGrid1.column2.AddObject("TextRed1","TextRed")
oForm.myGrid1.column2.AddObject("TextBlue1","Textblue")
oForm.myGrid1.column2.AddObject("TextYellow1","TextYellow")
oForm.Show(1)



Define Class myForm As Form
    AutoCenter = .T.
    Procedure Load()
    Create Cursor myCursor (Name C(20),Color C(10))
    Insert Into myCursor (Name,Color) Values ("MIKE","BLUE")
    Insert Into myCursor (Name,Color) Values ("JOHN","RED")
    Insert Into myCursor (Name,Color) Values ("PAUL","YELLOW")
    Go Top
Endproc
Enddefine

Define Class myGrid As Grid
    Visible = .T.
    ColumnCount = 2
    Width = 200
    Top = 20
    Left = 20
    Procedure Init()
    With This
        .column2.DynamicCurrentControl = "dynamic()"
        This.Parent.LockScreen = .F.
    Endwith
Endproc
Enddefine
Define Class TextRed As TextBox
    BackColor = Rgb(255,0,0)
    Visible = .T.
    Procedure Click
    This.Parent.Parent.Parent.LockScreen = .T.
    This.Parent.Parent.Init()
Endproc
Enddefine
Define Class TextBlue As TextBox
    BackColor = Rgb(0,128,255)
    Visible = .T.
    Procedure Click
    This.Parent.Parent.Parent.LockScreen = .T.
    This.Parent.Parent.Init()
Endproc
Enddefine
Define Class TextYellow As TextBox
    BackColor = Rgb(255,255,0)
    Visible = .T.
    Procedure Click
    This.Parent.Parent.Parent.LockScreen = .T.
    This.Parent.Parent.Init()
Endproc
Enddefine

Function Dynamic
Do Case
Case myCursor.Color = "RED"
    Return "textRed1"
Case myCursor.Color = "BLUE"
    Return "textBlue1"
Case myCursor.Color = "YELLOW"
    Return "textYellow1"
Endcase
Endfunc

Mike Gagnon

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close