DBNavigationButton: A data-aware TBitBtn,
DBSpeedButton: A data-aware TSpeedButton.

Version 1.4 Jun-04-1997
(C) 1997 Christoph R. Kirchner

Delphi 1 - 3


Description:

  DBNavigationButton is a data-aware TBitBtn.
  You can use a set of TDBNavigationButtons instead of a TDBNavigator.
  By setting the property DataButtonType you can define the glyph, the
  caption, the name and the OnClick-action at once.
  Like the buttons of a TDBNavigator, the TDBNavigationButton gets
  disabled if the DataSet is closed or the default OnClick-action is
  not possible or makes no sense.
  If you do not specify a special glyph, the corresponding glyph of
  TDBNavigator is used.
  By setting DataButtonType to nbCustom and setting DisableReasons
  manually, you can make buttons that are only enabled if it makes
  sense to press them.
  You can use the property Enabled to disable the button at design- or
  runtime as usual.

  DBSpeedButton is a data-aware TSpeedButton. It uses almost the same
  code as DBNavigationButton and has the same new properties.


Properties:

  DisableReasons:

    Use this property to say on what case the button has to be disabled.
    It is set automatic if you set DataButtonType <> nbCustom.

    DisableReason  | Disable if Dataset is...
    ---------------+-------------------------
      drBOF        | EOF
      drEOF        | BOF
      drReadonly   | Readonly
      drNotEditing | Not in insert or edit-mode
      drEditing    | In insert or edit-mode
      drEmpty      | Both BOF and EOF

  DataButtonType:

    nbCustom:  No default action and you have to set DisableReasons manually
    nbPrior:   DisableReasons := [drBOF, drEditing, drEmpty]
    nbNext: .. DisableReasons := [drEOF, drEditing, drEmpty]
    nbFirst:   DisableReasons := [drBOF, drEditing, drEmpty]
    nbLast: .. DisableReasons := [drEOF, drEditing, drEmpty]
    nbInsert:  DisableReasons := [drReadonly, drEditing]
    nbDelete:  DisableReasons := [drReadonly, drEditing, drEmpty]
    nbEdit: .. DisableReasons := [drReadonly, drEditing, drEmpty]
    nbCancel:  DisableReasons := [drNotEditing]
    nbPost: .. DisableReasons := [drNotEditing]
    nbRefresh: DisableReasons := [drEditing]

  ConfirmDelete: Boolean
    If true and DataButtonType is nbDelete, the user gets asked
    if he really wants to delete the current record.

  MenuItem: TMenuItem
    If you link a MenuItem to a button, the property Enabled of
    the MenuItem gets changed if the property Enabled of the
    button changes. The OnClick-event of the MenuItem gets
    captured so it calls the Click-method of the button.

Events:

  OnDoAction(Sender: TObject; var ActionIsDone: Boolean)
    Use this Event instead of the OnClick-event if you want to be
    able to cancel the default-action by setting ActionIsDone to
    true. The OnClick-event is called before the OnDoAction-event.

  OnEnabledChanged: TNotifyEvent
    This event gets called after the property Enabled has changed.


Disclaimer:

  Users of this component must accept this disclaimer of warranty:
    "This unit is supplied as is. The author disclaims all warranties,
    expressed or implied, including, without limitation, the
    warranties of merchantability and of fitness for any purpose.
    The author assumes no liability for damages, direct or
    consequential, which may result from the use of this component."

  This component is donated to the public as public domain.

  This component can be freely used and distributed in commercial and
  private environments.

  The source code may be freely distributed and used. The author
  accepts no responsibility for its use or misuse.

  If you do find this component handy and you feel guilty for using
  such a great product without paying someone - sorry :-)

  Please forward any comments or suggestions to Christoph Kirchner at:
  ckirchner@geocities.com


Contents of NavBtn.zip:

  NavBtn.pas
    Contains TDBNavigationButton and its Register-procedure
  NavBtn.d16
    16-Bit NavBtn.dcr (image for the component palette)
  NavBtn.d32
    32-Bit NavBtn.dcr
  TstNb*.*
    Sample project using DBNavigationButtons
  DBSBtn.pas
    Contains TDBSpeedButton and its Register-procedure
  DBSBtn.d16
    16-Bit DBSBtn.dcr (image for the component palette)
  DBSBtn.d32
    32-Bit DBSBtn.dcr
  CoolNavBtn.dpk (COOLNA~1.DPK)
    To include DBSBtn as a separate package (Delphi 3)
  Readme.txt


Installation:

  To add this components to component palette do:
  - From Delphi IDE Options Menu select Options / Install Components
  - Use the Add- and then the Browse-button to add:
    - NavBtn.PAS for DBNavigationButtons
    - DBSBtn.PAS for DBSpeedButtons

  If you get a message like "NavBtn.DCU not found" (Delphi 1) or
  "Connot open complib.dcr" and "Wintypes.PAS not found" (Delphi 2),
  in most cases your search path got too long. Try to remove some
  components. You have to edit the search path to delete the path of
  a removed component. Then you can copy all removed components into
  one directory (e.g. \Delphi\Lib, or create a new one) to install
  them again.


Tips:

  If you want to use different standard glyphs for TDBNavigation-
  Buttons and TDBNavigator, edit \Delphi\LIB\DBCTRLS.RES with the
  Image Editor.

  On the Delphi-Super-Page (http://sunsite.icm.edu.pl/delphi/), you
  can find a very good DBCTRLS.RES in the Delphi-1-Freeware section:
    spicenav.exe (571,378 bytes) "Spiced up" DBNavigator -
    Includes a *.bmp & *.ico viewer, and icon grabber
    ( added 8-Sep-95 ) by turnier@panix.com

  I recommend to use the DBNavigationButtons on a TAlignPanel-
  Component. This is a TPanel that aligns its child controls to
  equal size. To arrange the DBNavigationButtons in an AlignPanel,
  just move them with the mouse. The TabOrder property of the
  DBNavigationButtons get adjusted automatically.
  You can find the AlignPanel at 'The Delphi Component Building Site':
  http://www.geocities.com/SiliconValley/Heights/7874/delphi.htm

  If you already have DBNavigationButtons in your projects and you
  want to change them to TSpeedButtons, just insert a {$DEFINE
  DBSpeedButton} at the begin of NavBtn.PAS and recompile the library.
  At the first time you are loading your projects then, you will get
  the message that the property TabOrder of the DBNavigationButtons
  is missing - press ignore, TSpeedButtons don't have it.


Updates:

  Version 1.1:
  - Bugfix: Now it is possible to assign an event-handler procedure
    to OnClick at runtime. Frank Emser sent me a bug-report with
    corrected source - Thank you, Frank!

  Version 1.2:
  - Bugfix: Procedure Click moved into public section.
  - Bugfix: Caption gets not changed when Component gets pasted
    from clipboard.
  - OnEnabledChanged event added.
  - If DataButtonType is nbPrior or nbNext, a timer will call the
    procedure Click periodically while the button is pressed.

  Version 1.3:
  - Frank Emser changed the code to work with Delphi 3. Thanks again!
  - DBSpeedButton added (Frank's idea!)

  Version 1.4:
  - Property MenuItem added. Made by Jair Roberto Nunes da Silva
    from Brasil.

PS:

  Maybe you can find an update of this component at
  'The Delphi Component Building Site':
  http://www.geocities.com/SiliconValley/Heights/7874/delphi.htm

  Also, there are components that are not released to the
  Delphi-Super-Page yet because they are not tested, not finished,
  without readme or just currently under construction -
  if one or more of them are useful for you:
  You can help me beta-testing them... :-)

  Thanks to Frank Emser for a bug-report with corrected source and
  for the Delphi-3-version.
  Thanks to Eddie Shipman who created the DCR file.
  Thanks to Jair Roberto Nunes da Silva for the MenuItem-property.

