Refresh Method
Class: tstoolbar
Expand/Collapse source code of procedure Refresh Source Code
LPARAMETERS tcCondition
LOCAL llBOF, ;
      llEOF, ;
      llAllowEdits, ;
      llAllowNew, ;
      llSaveAndRestore

IF PARAMETERS() = 0
  tcCondition = ""
ENDIF

llBOF = BOF() OR (tcCondition = "BOF")
llEOF = EOF() OR (tcCondition = "EOF")

*-- Update navigation buttons
this.cmdFirst.Enabled = !llBOF
this.cmdPrior.Enabled = !llBOF
this.cmdNext.Enabled = !llEOF
this.cmdLast.Enabled = !llEOF

*-- Update New, Save, Restore, and Close buttons
IF FormIsObject() 
  IF TYPE("_screen.Activeform.lAllowEdits") <> "U"
    llAllowEdits = _screen.Activeform.lAllowEdits
    llAllowNew = _screen.Activeform.lAllowNew
    *- llSaveAndRestore = _screen.Activeform.lAllowEdits AND _screen.Activeform.DataChanged()
    this.cmdNew.Enabled = llAllowNew
    this.cmdSave.Enabled = llAllowEdits
    this.cmdRestore.Enabled = llAllowEdits
  ENDIF
  this.cmdClose.Enabled = _screen.Activeform.Closable
ENDIF  

RETURN

*-- Chart to help determine enabled property
*-- of navigation buttons based on llBOF and llEOF
*-- values.
*            FIRST    PREV    NEXT    LAST
* EOF,  BOF    .F.      .F.      .F.      .F.
*!EOF,  BOF    .F.      .F.      .T.      .T.
* EOF, !BOF    .T.      .T.      .F.      .F.
*!EOF, !BOF    .T.      .T.      .T.      .T.