Traveler
24-02-2006, 05:03 PM
I have a few problems with the buttons in my game.
Currently I have a class button that looks a bit like the following
TButton = class
private
(..)
FOnClick : TNotifyEvent;
procedure doClick; dynamic;
public
(..)
property OnClick : TNotifyEvent read FOnClick write FOnClick;
end;
I also have a list that hold these buttons.
At initialization I create an x number of buttons
buttonlist.addButton(x, y, width, height, title);
What I need now, is to attach predesigned procedures or functions to these dynamically created buttons.
My first quess was to create a new class that holds all these procedures and then do something like
ButtonList[1].OnClick := btnEvents.changeMouse;
but somehow thats not really working.
I was kinda hoping someone has any thoughts on how to solve this.
Thanks a bunch!
Currently I have a class button that looks a bit like the following
TButton = class
private
(..)
FOnClick : TNotifyEvent;
procedure doClick; dynamic;
public
(..)
property OnClick : TNotifyEvent read FOnClick write FOnClick;
end;
I also have a list that hold these buttons.
At initialization I create an x number of buttons
buttonlist.addButton(x, y, width, height, title);
What I need now, is to attach predesigned procedures or functions to these dynamically created buttons.
My first quess was to create a new class that holds all these procedures and then do something like
ButtonList[1].OnClick := btnEvents.changeMouse;
but somehow thats not really working.
I was kinda hoping someone has any thoughts on how to solve this.
Thanks a bunch!