Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grids
Message
De
16/08/2004 05:59:59
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
11/08/2004 14:46:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Grids
Divers
Thread ID:
00932444
Message ID:
00933494
Vues:
22
>I have a grid that is used to enter child data to a parent record. When I enter a record I would like the record to be entered at the top of the grid and not the last record of the grid?

Claude,
Use a view. In your view have a fake expression that'd index on order you want. ie:
open database testdata
create SQL view vCustomer as ;
  select *, 0x80000000-RECNO() AS rcorder FROM testdata!customer
close databases all
Then in your form create a grid from this view (say grdVcustomer), set KeyPreview to .t.
Assuming you want to use Ctrl+DnArrow as 'AddNew' :
*Form.init
Select vcustomer
CursorSetProp("Buffering",3,'vCustomer')
Index On rcorder tag myOrder
CursorSetProp("Buffering",5,'vCustomer') && Just assumed you want to use table buffering

* Form.Keypress
Lparameters nKeyCode, nShiftAltCtrl
Local ix
If nKeyCode = 145 And nShiftAltCtrl = 2 and ;
	Type('this.ActiveControl')='O' and ;
        Compobj(this.ActiveControl, this.grdVcustomer)
  DoDefault()
  Nodefault
  Insert Into vcustomer (rcorder) Values (0x80000000-(Reccount()+1))
  Locate
  With This.grdVcustomer
    .Refresh
    For ix = 1 To .ColumnCount
      If .Columns(m.ix).ColumnOrder = 1
        .Columns(m.ix).SetFocus()
        Exit
      Endif
    Endfor
  Endwith
Endif
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
Répondre
Fil
Voir

Click here to load this message in the networking platform