Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid's column readonly based on another grid's value
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01505542
Message ID:
01505553
Views:
26
>>>>
>>>>
>>>>? ComboBox1.DisplayValue
>>>>
>>>
>>>Kidding, right? :)
>>
>>
>>Nope,
>>ComboBox has this property :-)
>
>I know, but it doesn't work.
>
>WAIT WINDOW TIMEOUT 1 this.colActiv_Type.cboEvents.DisplayValue && Displays the same value when I navigate through the grid.
>
>I think I may need to use a value and select the descrip into an array instead. This hopefully should work.

That works for me:
oForm = CREATEOBJECT([form1])
oForm.Show(1)

**************************************************
*-- Form:         form1 (d:\all_zapl\asd.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   03/30/11 08:08:14 PM
*
DEFINE CLASS form1 AS form


    Top = 0
    Left = 0
    Height = 216
    Width = 332
    DoCreate = .T.
    Caption = "Form1"
    Name = "Form1"


    ADD OBJECT grid1 AS grid WITH ;
        ColumnCount = 2, ;
        Height = 200, ;
        Left = 4, ;
        Panel = 1, ;
        RecordSource = "crsGrid1", ;
        RowHeight = 23, ;
        Top = 2, ;
        Width = 320, ;
        Name = "Grid1", ;
        Column1.ControlSource = "crsGrid1.Fld1", ;
        Column1.Name = "Column1", ;
        Column2.ControlSource = "crsGrid1.Fld2", ;
        Column2.Width = 197, ;
        Column2.Sparse = .F., ;
        Column2.Name = "Column2"


    PROCEDURE Init
        thisform.Grid1.Column2.AddObject([Combo1],[ComboBox])
        thisform.Grid1.Column2.CurrentControl = [Combo1]
        thisform.Grid1.Column2.Combo1.Visible = .t.
        thisform.Grid1.Column2.Combo1.RowSourceType = 3 
        thisform.Grid1.Column2.Combo1.RowSource = [SELECT Fld1, Fld2 FROM crsCombo INTO CURSOR crsTest]
        thisform.Grid1.Column2.Combo1.Requery()
    ENDPROC


    PROCEDURE Load
        CREATE CURSOR crsGrid1 (Fld1 C(20), Fld2 I)
        FOR asd = 1 TO 20
            INSERT INTO crsGrid1 VALUES ([Rec ] + TRANSFORM(asd),asd)
        NEXT
        GO TOP IN crsGrid1 
        CREATE CURSOR crsCombo (Fld1 C(20), Fld2 I)
        FOR asd = 1 TO 20
            INSERT INTO crsCombo VALUES ([Cbo ] + TRANSFORM(asd),asd)
        NEXT
    ENDPROC


    PROCEDURE grid1.AfterRowColChange
        LPARAMETERS nColIndex
        WAIT WINDOW this.Column2.Combo1.DisplayValue +[   ]+TRANSFORM(this.Column2.Combo1.Value) NOWAIT 
    ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform