I create buttons dynamically and need to know which one has been clicked and which button's submenu has been invoked. Cannot find an easy solution, is there one or if not what is the best difficult approach?
Creation code is as follows (old program so it's Delphi4).
Creation code is as follows (old program so it's Delphi4).
Code:
var
btnMain: array [1..19] of TButton;
stlButtonID: TStringList; //IDs are read into here
for i := 0 to stlButtonID.Count-1 do
begin
btnMain[i] := TButton.Create(Self);
btnMain[i].Parent := Self;
btnMain[i].Name := stlButtonID[i];
btnMain[i].PopupMenu := mnuButtons;
....and so on