Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BeforeRowColChange Event in GRID
Message
De
08/04/1999 04:04:55
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
07/04/1999 23:26:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00206324
Message ID:
00206348
Vues:
14
>Hi All,
> I want to prevent user from changing the Active Row if that record is not valid. Where can i write the code of that. And how i can use the event BeforeRowColChange. This gives me the current col number and not row.
>
>TIA
>Amit

This is part of class code and I didn't stripped class specific properties. But shows the main idea :
PROCEDURE BeforeRowColChange
LPARAMETERS nColIndex
llChangingRow = .f.
WITH this
  IF lastkey() = 145 && Adding new rec
    .nLastValidRec = .nCurrec
  ENDIF
  thisform.LockScreen = .lInGrid
  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
    IF !empty(.columns(nColIndex).dynamiccurrentcontrol)
      cCurrentControl = eval(.columns(nColIndex).dynamiccurrentcontrol)
    ELSE
      cCurrentControl = .columns(nColIndex).currentcontrol
    ENDIF
    WITH evaluate(".columns(nColIndex)."+cCurrentControl)
      .value = .value && So we can evaluate table ruleexpression
    ENDWITH

    IF !empty(dbgetprop(.recordsource,"Table","RuleExpression")) ;
        and !evaluate(dbgetprop(.recordsource,"Table","RuleExpression"))
      thisform.LockScreen = .F.
      WAIT window nowait .cWarning
      NODEFAULT
    ENDIF
  ENDIF
ENDWITH
ENDPROC


PROCEDURE Valid
WITH this
  IF !empty(.columns(.nActiveColumn).dynamiccurrentcontrol)
    cCurrentControl = eval(.columns(.nActiveColumn).dynamiccurrentcontrol)
  ELSE
    cCurrentControl = .columns(.nActiveColumn).currentcontrol
  ENDIF
  WITH evaluate(".columns(.nActiveColumn)."+cCurrentControl)
    .value = .value && So we can evaluate table ruleexpression
  ENDWITH
  .refresh
  IF !.freetable ;
      and !empty(dbgetprop(.recordsource,"Table","RuleExpression")) ;
      and !evaluate(dbgetprop(.recordsource,"Table","RuleExpression"))
    IF messagebox(.cRevertMessage,4+16,"") = 6
      TABLEREVERT(.f.,.recordsource)
    ELSE
      RETURN .f.
    ENDIF
  ENDIF
  .lInGrid = .f.
  IF .lTableupdate
    TABLEUPDATE(2,.t.,.recordsource)
  ENDIF
  IF eof(.recordsource) and .nLastValidRec # 0
    lcRecSource = .recordsource
    .recordsource = ""
    GO .nLastValidRec in (lcRecSource)
    .recordsource = lcRecSource
    .RestoreControlSource()
    .recchange()
  ENDIF
  SELECT (.lcOldAlias)
ENDWITH
ENDPROC
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