Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The Foxyclasses edit grid
Message
De
14/08/2003 06:37:55
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00819412
Message ID:
00820056
Vues:
15
>Thanks, that's now sorted.
>
>Q: In my child grid the first entry does not appear when I first add it.
>
>If I save away the buffered changes, then go off the parent record & back on, the new child record appears as you would expect.
>
>Once there is at least one record for my parent then it all works fine?
>
>Any ideas?

Robin,
I'm really not sure if I understood it right. I see the record as soon as it's added to EditGrid. One problem is that if there are no child records for a particular parent then you can't add one in EditGrid with simply using Ctrl+DnArrow. That's normal because there is row in child that you could invoke a keypress from. Either you'd add a record in EditGrid.When or via a commandbutton etc to create one child row first.
It's getting confusing in daily English :) OK here is a sample code, look at it and tell me is this what you meant and resolves your question :

Note: Sample uses Testdata.dbc files. You might need to set path. Also modify FoxyClasses location in define if it's different on your box.
Some customer's (like WOLZKA ?) has no child yet.
#Define FOXYCLASSESPATH "d:\FoxyClasses"

If ! ( FOXYCLASSESPATH + "\CLASSES\GRIDS.VCX" $ Set('Classlib') )
  Set Classlib To ;
    (FOXYCLASSESPATH + "\Classes\Grids.vcx") Additive
Endif

oForm = Createobject('myForm')
oForm.Show
Read Events

Define Class myForm As Form
  DataSession = 2
  Top = 0
  Left = 0
  Height = 469
  Width = 786
  DoCreate = .T.
  Caption = "Form1"
  Name = "Form1"


  Add Object editgrid1 As editgrid With ;
    Height = 252, ;
    Left = 24, ;
    RecordSource = "orders", ;
    Top = 192, ;
    Width = 648, ;
    ckeyfield = "cust_id", ;
    ckeyexpression = "customer.cust_id", ;
    Name = "Editgrid1"


  Add Object locatorgrid1 As locatorgrid With ;
    Height = 156, ;
    Left = 24, ;
    Top = 12, ;
    Width = 648, ;
    csql = "cust_id,company,contact from customer", ;
    followfield = "cust_id", ;
    followtable = "customer", ;
    followtag = "cust_id", ;
    Name = "Locatorgrid1"


  Add Object command1 As CommandButton With ;
    Top = 384, ;
    Left = 684, ;
    Height = 27, ;
    Width = 84, ;
    Caption = "Add", ;
    Name = "Command1"


  Procedure Init
    With This.editgrid1
      .ChildOrder = 'cust_id'
      .LinkMaster = .RecordSource
      .RelationalExpr = 'cust_id'
    Endwith
  Endproc


  Procedure command1.Click
    Insert Into Orders (cust_id) Values (customer.cust_id)
    Thisform.editgrid1.SetFocus()
  Endproc

  Procedure editgrid1.When
    If !Seek(customer.cust_id,'orders','cust_id')
      Insert Into Orders (cust_id) Values (customer.cust_id)
    Endif
  Endproc

  Procedure Load
    Use customer In 0
    Use Orders In 0
  Endproc
  Procedure QueryUnload
    Clear Events
  Endproc
Enddefine
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform