Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Foxy Classes - Set status bar off
Message
De
04/06/2003 06:05:44
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00781478
Message ID:
00796048
Vues:
25
>Cetin,
>
>Did it in FP7 and all is fine. Started to use the edit grid of your class & I just love it.
>
>Q: How do I make grid limit itself to say 20 records?
>
>Q: Is the a key combination fo deleting rows from the grid, or is it just case of setting to an ok label command and deleting the current record in the grid?

Thanks :)
I'm afraid couldn't understand well.
Limiting to 20 records. Do you mean if there are 20 records, prevent adding a new one on Ctrl+DnArrow ? If so check class' AftreRowColChange method. Copy code from there to your grid's AfterRowColChange, modify 3rd line slightly to check for reccount() :
 if !mdown() and lastkey() = 145 ;
     and !(.lValidate and !evaluate(.cValidation))

* Change above line to
 if !mdown() and lastkey() = 145 ;
     and reccount(.recordsource) < 20 ;
     and !(.lValidate and !evaluate(.cValidation))
Note: I directly used reccount() here but with deleted records this might not be what you want. In that case there are many ways just to get nondeleted count but an easy one would be to add a property to this grid's form - say GridReccount. With a property like this then above code would be :
 if !mdown() and lastkey() = 145 ;
     and thisform.GridReccount < 20 ;
     and !(.lValidate and !evaluate(.cValidation))
    thisform.GridReccount = thisform.GridReccount + 1
On any delete operation you'd decrement that property.

To delete provide a command button and set its caption to something like '\< Delete' (So Alt+D 'clicks' it too while in Grid) :
*Delete button click code - Caption \<Delete
with thisform.myEditGrid
  Delete In (.RecordSource)
  Go Recno()
  .setfocus()
* If implemented GridReccount
  thisform.GridReccount = thisform.GridReccount - 1
endwith
PS: 'set deleted on' to have record removed from grid. Also pay attention if class would do the update (lTableUpdate property) or you manually.
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