This is in Delphi Pascal
I have dynamical created a 2d array of buttons. I want it such that when you click these buttons, the button pressed will dissapear. (This is to make a minesweeper style game).
Currently i have this array of these buttons, and am trying to set the onclick event to a procedure and passing in the x and y indexes of this button to the procedure such that it can hide the correct button.
Here is what i am using to link to the procedure:
buttons[x,y].OnClick := buttonClicked(x,y);
The x and y are made from a for loop, in order that i can have a 2d array.
An this is the error I am getting.
E2010 Incompatible types: 'TNotifyEvent' and 'procedure, untyped pointer or untyped parameter'
Here is the Procedure:
procedure TMainPage.buttonClicked(buttonx: Integer; buttony: Integer); begin buttons[buttonx,buttony].Visible:=False; end;
Im assuming that the problem is that you cannot send variables through on the OnClick event. I am unsure of a way to do what i want, so guidance would be appreciated.
buttonClickedneeds to be a method of an object, not a stand-alone procedure and have the same method signature as anOnClickhandler, otherwise they are not assignment compatible. If you don't know these concepts, you have some reading to do.