TfxDBNav Component (c) 1997 by Chuck Gadd. All rights reserved. Version Beta 0.61 8/4/97 You are granted permission to use this component in any program royalty-free. You MAY NOT charge any fee for distributing this component. Use of this component is at your own risk. I do not make any warranty regarding this component, but it's based on code I've used for quite a while. (Ok, so I'm not good at lawyer-talk ) I make no promises regarding Updates/bug fixes, but if you find any bugs or have any feature suggestions, please let me know. My email address is cgadd@cfxc.com. Feel free to drop me an email just to say 'I like it!'. If you hate it, don't bother telling me. Updates / Information / Other Components will be available from my Web page at http://www.csd.net/~cgadd/delphi.htm Description: ----------------------------------------------------------------- Replacement for Delphi's TDBNavigator control. This fxDBNav allows you to link TSpeedButtons (or TSpeedButton descendants ) on your form to each of the Navigators functions. This allows you to redefine the appearance/position/glyph of all the navigator buttons. It also allows you to include 10 'OTHER' buttons that will be automatically enabled or disabled based on the DATASET.ACTIVE property. You can also attach your own code, which will be triggered automatically, to enable or disable the buttons based on any conditions you wish. Installation: --------------------------------------------------------------- Unzip the .DCU file and the .R16 or .R32 into a directory in your library search path. for Delphi 1, from the main menu choose: Options|Install Components|Add for Delphi 2 and Delphi 3 choose: Component |Install|Add Change the File type to .DCU files, then browse to find the Dir where you unzipped this components files. It will be installed onto a new page titled 'CyberFX'. ATTENTION!!!!!!!!!!!!!!! Before installing ANY components, you should make a safe copy of your Delphi Library files (or in the case of D3, the Package files). If it gets mangled, you're hosed!!!! I haven't had any problems with this component trashing my VCL, but why take chances??? Version 0.61 Changes: --------------------------------------------------------------- - Added a OnNavClick event to allow developers to provide their own handling on the standard navigator buttons. (Thanks to Wouter Wessels) - Fixed an Access Violation error when clearing a button propery of the navigator. (Thanks to Wouter Wessels for reporting this one) - Changed the Destroy method to set all Navigator buttons to True when removing a TfxDBNav component. (Thanks to Tony Dunn) Properties: --------------------------------------------------------------- Enabled : If set to false, will disable all buttons without. If set to true, Button status will be determined based on Navigator rules. DataSource: The datasource to navigate. ConfirmDelete: If true, will display a confirmation dialog box before delete. Uses same string resources used for TDbNavigator. Btn_First, Btn_Prior, Btn_Next, Btn_Last, Btn_Insert, Btn_Delete, Btn_Edit, Btn_Post, Btn_Cancel, Btn_Refresh : Buttons to perform the actions as specified in TDbNavigator. These buttons will be automatically enabled or disabled based on the rules in the original TDbNavigator. Also see the OnBtnEnabled event below. NOTE: TfxDbNav takes over the OnClick events for all buttons used for default DbNavigator functions. A future version of TfxDbNav will include events to allow you to attach your own code to each of those buttons. BtnOther1 .. BtnOther10 : User defined buttons, for any purpose you desire. You control their action based on the TSpeedButtons OnClick event. They will be automatically enabled/disabled based on the TfxDbNav.Enabled property and the dataset's Active property. Also see the OnBtnEnabled event below. Methods: --------------------------------------------------------------- NavClick( Sender: TObject ) : Called when a normal TDbNavigator button is clicked. Events: --------------------------------------------------------------- OnNavClick : Triggered when one of the TfxDbNav buttons is clicked. See the section below for a sample OnNavClick template. OnBtnEnable : Triggered after TfxDbNav Enables/Disables the buttons. Allows you to add your own rules for Enabling/Disabling buttons. For example: If you add a 'Other1' button that you would like Enabled/Disabled the same as the 'INSERT' button, you would add the following code: Btn_Other1.Enabled := Btn_Insert.Enabled; OnNavClick Event: ------------------------------------------------------------------------- The Button that was pressed will be sent in the BtnPressed property as an ordinal type of TfxNavBtns. The ClickHandled property is used to supress the default Navigator action. If you set ClickHandled to True, the default action will NOT occur. If ClickHandled is set to False, the default action will occur. It is set to FALSE by default. The following code will serve as an all-purpose template for this event handler: procedure TForm1.fxDBNav1NavClick(Sender: TObject; BtnPressed: TfxNavBtns; var ClickHandled: Boolean); begin case BtnPressed of fxnbPrior: begin end; fxnbNext: begin end; fxnbFirst: begin end; fxnbLast: begin end; fxnbInsert: begin end; fxnbEdit: begin end; fxnbCancel: begin end; fxnbPost: begin end; fxnbRefresh: begin end; fxnbDelete: begin end; end; {case} end; Interesting Note: ---------------------------------------------------------- Someone on Usenet was wondering why the 'REFRESH' button on a standard TDbNavigator was always disabled when connected to a TQuery component. Here is the code used to set the Refresh buttons Enabled property: fButtons[fxnbRefresh].Enabled := not (FDataLink.DataSet is TQuery); So, it is always disabled for TQuery datasources. I do not know why. If you wish to change this behavior, you can do so in the OnBtnEnable event listed above. I use the following code to set it's enabled property: btn_Refresh.Enabled := True; This works because the OnBtnEnable is only called when the Datasource is active. If the Datasource is not active, or the TfxDbNav is not enabled, then all buttons will be set to False. TfxDbNav Source Code: ---------------------------------------------------------- Source code is available for a one-time fee of $15.00. Please email me at cgadd@cfxc.com if you wish to purchase source code. Future revisions: ----------------------------------------------------------- Currently on the To-Do list for this component: