Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grids and row disabling
Message
De
09/09/1999 11:51:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00262870
Message ID:
00262925
Vues:
19
>Hello all
>
>I am having a problem comprehending how to disable rows on a grid
>
>I am doing a invoice screen and I want to disable a row after completing a line item and adding a new record. Can anybody help me out, I can't even see how to reference a row except a active row number
>
>Any and all help will be appreciated


Stephen,
There are ways to do it. But some of them consists complex grid math. Take the easy way I would say if your table is RowBuffered or have a flag field. With rowbuffering you would do something like :
this.setall("Enabled", recno()<0,"Textbox")
If you prefer the math way then you could furnish this code to your taste :
*beforerowcolchange
LPARAMETERS nColIndex
llChangingRow = .f.
WITH this
  oColumn = .columns(.FindColumn(nColIndex))
  IF lastkey() = 145 && Adding new rec - personal choice to trigger add (Ctrl+dnarrow)
    .nLastValidRec = .nCurrec   && Both custom grid properties
  ENDIF
  thisform.LockScreen = .lInGrid && Related with higlight - custom property
  IF mdown()
    lnBottom		= .top+.headerheight+.relativerow * .rowheight
    lnTop			= lnBottom - this.rowheight
    lnMouseRowPos	= mrow(wontop(),3)
    lnMouseColPos	= mcol(wontop(),3)
    llChangingRow	= !(between(lnMouseRowPos,lnTop, lnBottom) ;
      and between(lnMouseColPos,.left,.left+.width))
  ELSE
    llChangingRow	= inlist(lastkey(),24,5,18,3,145,148)
  ENDIF

  IF llChangingRow
    *....  && User attempted to change row
    * if cannot let to go
    nodefault
    *else
    *....
    *endif
  ELSE
    *...
  ENDIF
ENDWITH

* Custom findcolumn method
LPARAMETERS nColIndex
LOCAL ix
WITH this
  FOR ix = 1 to .columncount
    IF .columns(ix).ColumnOrder = nColIndex
      RETURN ix
    ENDIF
  ENDFOR
ENDWITH
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