Hi All,
I have a new component called Tarraybutton which is meant to display a grid-like array of tbuttons (actually TGridButtons -- but you could change it to tbutton for debugging). It compiles fine but when I use it at design time and change the number of RowCount and ColCount these do NOT affect the displayed number of rows and columns. This is supposed to work like a TStringGrid, except with Buttons.
I think that I have forgotten to include the code which tells it how to display the component. Can someone please help me to debug this component???
Best Regards,
PEW
Hobart, Tasmania, Australia
unit arraybutton;
//{$MODE Delphi}
{$mode objfpc}{$H+}{ ------------------------------------------------------------ Author: Unknown +
------ modifications by Peter E. Williams +
suggestions from alt.comp.lang.borland-delphi newsgroup + suggestions from Mark Meyer in
code is freeware and is placed into the Public Domain by Peter E. Williams
( ).
Version 0.1a - for Lazarus by PEW
Date: 17 June 2010
Added :--------
FRowCount, FColCount: integer;
procedure SetRowCount(r: integer);
procedure SetColCount(c: integer);
Version: 0.04a - by PEW. 'col' changed to 'column'. Setcol changed to
setcolumn.
interfaceuses
{Windows,}{ Messages,} SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
{StdCtrls,}
LcLType, lresources,
ugradbtn;
type
TOnArrowKeyEvent = procedure( Sender: TObject;
Key: Word;
Row: integer;
Column: integer;
RowCount : integer; // new
ColCount : integer; // new
var handled: boolean) of object;
TArrayButton = class(TGradButton) { class(TButton) }
private
IsFocused: Boolean;
FCanvas: TCanvas;
FRow,FColumn, FRowCount, FColCount: integer;
FUseDefaultKeyHandler : boolean;
FOnArrowKey : TOnArrowKeyEvent;
procedure SetRow(r: integer);
procedure SetColumn(c: integer);
procedure SetRowCount(r: integer);
procedure SetColCount(c: integer);
procedure TArrayButton.SetRowCount(r: integer);
begin
if r>-1 then
FRowCount:= r;
end;{------------------------------------------------------------}
procedure TArrayButton.SetColCount(c: integer);
begin
if c>-1 then
FColCount:= c;
end;{------------------------------------------------------------}
