Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 To: Simon Jones
  Where is Simon Jones?
 Market Drayton
 United Kingdom
 Simon Jones
 Tags
Subject: RE: Launching A Form From A Column In A Row In A Grid
Thread ID: 104584 Message ID: 104589 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Thursday, August 17, 2006 10:57:32 PM         
   


> I have a grid on a form based on a cursor.
>
> For some of the rows in the grid I wish to have a button (or something)in a column that can launch a form, but for the other rows have the column show nothing. In other words have something visual in the grid for those rows where another form can be fired.
>
> I am not sure how to achieve this, any ideas ?
>
> Thanks in advance
>
> simon


Try something like:
oForm = CREATEOBJECT([Form1])
oForm.Show(1)

**************************************************
*-- Form:            form1 (d:\all_zapl\test.scx)
*-- ParentClass:     form
*-- BaseClass:       form
*-- Time Stamp:      08/17/06 11:53:00 PM
*
DEFINE CLASS form1 AS form


    DataSession = 2
    Top = 0
    Left = 0
    Height = 250
    Width = 373
    DoCreate = .T.
    Caption = "Form1"
    Name = "form1"


    ADD OBJECT grid1 AS grid WITH ;
        ColumnCount = 2, ;
        Height = 200, ;
        Left = 19, ;
        Top = 8, ;
        Width = 320, ;
        Name = "Grid1", ;
        Column1.Name = "Column1", ;
        Column2.Sparse = .F., ;
        Column2.Name = "Column2"


    PROCEDURE Init
        thisform.Grid1.Column2.AddObject([Command1],[CommandButton])
        thisform.Grid1.Column2.RemoveObject([Text1])
        thisform.Grid1.Column2.Command1.Visible = .t.
        thisform.Grid1.Column2.CurrentControl = [Command1]
        thisform.grid1.Column2.DynamicBackColor = [IIF(RECNO() %2=0,RGB(255,0,0),RGB(255,255,255))]
        BINDEVENT(thisform.Grid1.Column2.Command1,[Click],thisform,[ClickMe])
    ENDPROC


    PROCEDURE Load
        CREATE CURSOR crsTest (Fld1 I, Fld2 C(20))
        FOR asd = 1 TO 20
            INSERT INTO crsTest VALUES (asd, TRANSFORM(asd))
        NEXT
        GO TOP
    ENDPROC


    PROCEDURE retyrnmyval
    ENDPROC


    PROCEDURE testassign
    ENDPROC


    PROCEDURE ClickMe
        IF RECNO() % 2 == 0
           WAIT WINDOW [I am here]
        ENDIF
    ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************


Borislav Borissov



ENTIRE THREAD

Launching A Form From A Column In A Row In A Grid Posted by Simon Jones @ 8/17/2006 10:27:28 PM
RE: Launching A Form From A Column In A Row In A Grid Posted by Dexter Carlit @ 8/17/2006 10:51:38 PM
RE: Launching A Form From A Column In A Row In A Grid Posted by Simon Jones @ 8/18/2006 12:13:32 PM
RE: Launching A Form From A Column In A Row In A Grid Posted by Borislav Borissov @ 8/17/2006 10:57:32 PM
RE: Launching A Form From A Column In A Row In A Grid Posted by Simon Jones @ 8/18/2006 4:58:58 PM
RE: Launching A Form From A Column In A Row In A Grid Posted by Borislav Borissov @ 8/18/2006 5:42:38 PM
RE: Launching A Form From A Column In A Row In A Grid Posted by Simon Jones @ 8/18/2006 6:51:06 PM