Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-08

RowCount and ColCount properties do NOT affect the display of the number of rows and columns in my component.

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter E Williams

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.
interface

uses
{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;

{------------------------------------------------------------}

Proudly developing Quality Cross Platform Open Source Games Since 1970 with a Commodore PET 4016 with 16 KRAM http://pews-freeware-games.org (<--- brand new) -------------- next part -------------- A non-text attachment was scrubbed... Name: arraybutton.pas Type: text/x-pascal Size: 9410 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100829/e8e6a745/attachment.bin>

Reply by email