DBBitBtn: A data-aware TBitBtn,
DBSpeedButton: A data-aware TSpeedButton,
DBToolbarButton97: A data-aware TToolbarButton97.

Version 1.61 Oct-30-1997
(C) 1997 Christoph R. Kirchner

Delphi 1 - 3


Description:

  DBBitBtn is a data-aware TBitBtn.
  You can use a set of TDBBitBtns 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 TDBBitBtn 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-
  time or runtime as usual.

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

  TDBToolbarButton97 is a data-aware TToolbarButton97. It uses almost
  the same code as DBBitBtn and has the same new properties.
  It is made for Toolbar97 version 1.53 by Jordan Russell
  <jordanr7@aol.com>. Toolbar97 is not included in this package -
  you can find it at: http://members.aol.com/jordanr7
  Toolbar97 version 1.53 does not work with Delphi 1 - and I have not
  tested if the TDBToolbarButton97 runs with an earlier version of
  Toolbar97 (but there was a D1 version too).

  DBNavigationButton is a DBBitBtn, required for compatibillity if
  you have already installed a version <= 1.4.


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]
    nbAppend:  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.

  Disabled: Boolean (public, not published)

    If you want to force the button to stay disabled, set the
    property Disabled to true. To set Enabled to false does only
    work if the button is enabled (sorry, but the message
    CM_ENABLEDCHANGED gets only called if the property Enabled
    got changed). At designtime, you can use the property Enabled
    as usual.

Events:

  OnGetQuestion(Sender: TObject; var Question: string;
                var Buttons: TMsgDlgButtons; var HelpCtx: Longint)

    Use this Event if you want to ask the user before the action
    gets performed (Question <> '').

  OnBeforeAction(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 OnBeforeAction-event.

  OnAfterAction(Sender: TObject; var Error: Boolean)

    Called after the action is done. If Error is true, you can avoit
    the 'raise' by setting Error to false.

  OnEnabledChanged: TNotifyEvent

    This event gets called after the property Enabled has changed.


Disclaimer:

  Users of these components must accept this disclaimer of warranty:
    "These components are 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."

  These components are donated to the public as public domain.

  These components 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:

  DBBBtn.pas
    Contains TDBBitBtn and its Register-procedure
  DBBBtn.d16
    16-Bit DBBBtn.dcr (image for the component palette)
  DBBBtn.d32
    32-Bit DBBBtn.dcr
  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
  DB97Btn.pas
    Contains TDBToolbarButton97 and its Register-procedure.
    Delphi 2/3 and Toolbar97 (Tb97.pas) required
  DBBtnCmn.pas
    Used by DBBBtn.pas, DBSBtn.pas and DB97Btn.pas. You can change
    some constants here, e.g. choose the default language for the
    default button captions
  RpInsBtn.zip
    Contains the descendants DBRepInsBitBtn and RInsSBtn. The sample
    shows how to let the user fill a table with new records without
    pressing buttons after each new record
  NavBtn.pas
    Contains TDBNavigationButton and its Register-procedure.
    You do not need it, if this is the first time you install these
    components
  DRefresh.pas
    Contains a method to refresh datasets even if DbiForceReread()
    does not work (needed for refresh-buttons)
  TstNb.zip
    Sample project using DBBitBtn's
  TstNb97.zip
    Sample project using TDBToolbarButton97's
  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:
    - DBBBtn.PAS for TDBBitBtn
    - DBSBtn.PAS for DBSpeedButton

  If you get a message like "DBBBtn.DCU not found" (Delphi 1) or
  "Connot open complib.dcr" and "Wintypes.PAS not found" (Delphi 2),
  in most cases the 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 DBBitBtns on a TAlignPanel-
  Component. This is a TPanel that aligns its child controls to
  equal size. To arrange the DBBitBtns in an AlignPanel,
  just move them with the mouse. The TabOrder property of the
  DBBitBtns 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.

  Version 1.41:
  - Prepared to make descendants.
  - DataButtonType nbAppend added.
  - TDBRepInsBitBtn and TDBRepInsSpeedButton added. This was an idea
    of Fernando Antonio Anselmo from Brasil.

  Version 1.42:
  - New function for the refresh-button. If DbiForceReread() fails,
    the dataset gets refreshed by closing and opening the cursor again.

  Version 1.43, 1.44:
  - Correction of DRefresh.pas to work with Delphi 3 (sorry, I don't
    have Delphi 3, I can not test changes with D3)

  Version 1.45:
  - OnGetQuestion event added.
  - OnAfterAction event added.
  - Buttons are always disabled if the Dataset is not active.

  Version 1.46:
  - OnGetQuestion and OnAfterAction for the TDBRepInsXBtn's added.
  - Default button captions: Spanish added. (see unit DBBtnCmn)

  Version 1.47:
  - Bugfix made by Gil Yoktan: OnAfterAction was not always called.

  Version 1.5:
  - Language property added. Made by Gil Yoktan.

  Version 1.6:
  - TDBToolbarButton97 added.
  - Bugfix: OnAfterAction got called if action was cancelled.

  Version 1.61:
  - Property Disabled added.
  - Bugfix: The procedure DoAskQuestion returned nonsense.



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.
  - Frank Emser again, for the Delphi-3-version.
  - Eddie Shipman who created the DCR file.
  - Jair Roberto Nunes da Silva for the MenuItem-property.
  - Fernando Antonio Anselmo for the DBRepInsBitBtn idea.
  - Gil Yoktan for a bug-report and the Language property.
  - David Sancho for a bug-report.

  Thanks for all comments, bugfixes and enhancements!

