Priyatna Codes - My Programming Journey
 


You are here: Home Delphi Stuffs ButtonBar
ButtonBar Component

Version: 1.00
Release Date: May 26th, 2007

Introduction

ButtonBar is a free Visual Component Library (VCL) for Delphi. It is a button bar that takes a list of strings as its captions and accepts an imagelist as its glyphs. It shows the currently selected button in down state. It can show buttons horizontally or vertically. It is an alternative to toolbar or speed buttons.

I forgot the reason why I created this component. It's created sometime ago, around 2003. But I think it may be useful for some people.

 

License

This library is released under Mozilla Public License. You can use it in your freeware, shareware or commercial softwares. You can send your modification to me, and if I decide to include it in the main distribution, I will add your name as a contributor. You can read full licensing information here.

 

Installation

There is no special process to install it on Delphi. Just open ButtonBarD7.dpk on Delphi IDE and press Install button. I use Delphi 7. If you use another Delphi version, you may have to make some minor changes.

The component will appear in priyatna.org tab.

 

Methods

Here is some methods and properties of the component:

  • function GetIndexFromXY(const X, Y: Integer): Integer;
    Gets button index under the specified coordinate. This is useful when you want to know which button is clicked by a user, or hovered under the mouse, etc. For simpler usage, there's also OnChange event which is fired everytime the user clicks on a button.

  • property ButtonWidth: Integer;
    Specifies button width.

  • property ButtonHeight: Integer;
    Specifies button height.

  • property Images: TImageList;
    Specifies an image list for buttons.

  • property Buttons: TStringList;
    Specifies captions for buttons. Each string represents one button.

  • property Hints: TStringList;
    Specifies hints for buttons. Each string represents one button hint.

  • property ItemIndex: Integer;
    Specifies currently selected button index.

  • property ShowCaptions: Boolean;
    Specifies caption visibility.

  • property Direction: TBarDirection;
    Specifies how to layout the buttons, horizontally or vertically.

  • property OnChange: TNotifyEvent;
    Fired everytime user clicks on a button.

 

Download

Download full source code and demo here:

ButtonBar.zip
248 KB

Version: 1.00
Release Date: May 26th, 2007