DBBitBtn, DBSpeedButton and TDBToolbarButton97

TDBBitBtn is a data-aware TBitBtn, DBSpeedButton is a data-aware TSpeedButton.

Using them instead of TDBNavigator, you can put them on a D3-CoolBar, change glyph and caption, adding special buttons like "Print", link them to a MenuItem and cancel the default-action.

They work with Delphi 1 to 3.

By setting the property DataButtonType you can define the glyph, the caption, the component-name and the OnClick-action at once. Like the buttons of a TDBNavigator, these buttons get 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.

If you want to use different glyphs for DBBitBtn / DBSpeedButton and TDBNavigator, edit \Delphi\LIB\DBCTRLS.RES with the Image Editor.
On the Delphi-Super-Page 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 DBXButtons on a TAlignPanel-Component. This is a TPanel that aligns its child controls to equal size. To arrange the DBXButtons in an AlignPanel, just move them with the mouse. The TabOrder property of the DBBitBtn's get adjusted automatically.

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 <jordanr@iname.com>.
Toolbar97 is not included in this package - you can find it at: http://www.connect.net/jordanr/.
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 is a D1 version of of Toolbar97 too). The actual version of Toolbar97 is 1.6. But I have not tested TDBToolbarButton97 with this version of Toolbar97 because it became shareware now - sorry, but I don't like to use shareware.

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: (This is the version I have released to the DSP)
    • Property MenuItem added. This is 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:
    • Corrections 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

  • Version 1.62:
    • Default button captions: Dutch added. (see unit DBBtnCmn)
    • Bugfix: RefreshDataset (unit DRefresh, used by the refresh button) did raise an exception if the dataset was empty

  • Version 1.7:
    • OnGetEnabled event added
    • C++ Builder 1 support
    • Should work with D4

Thanks for all comments, bugfixes and enhancements!

Download (50KB, Version 1.7, Last modified: Feb-03-1999)

[Back]Back to The Delphi Component Building Site

1