Computer Science Canada

Help with button callback procedure

Author:  mikiehahn [ Sat Feb 13, 2016 7:01 pm ]
Post subject:  Help with button callback procedure

What is it you are trying to achieve?
I am having trouble getting button creation code to run.


What is the problem you are having?
I have this variable define.
I have a procedure defined that has one boolean parameter
Then I try to create a button using the procedure as a callback procedure.

Here is the code snipet (turing 4.1.1):

...
const numInPins : int := 8 % the number of input pins

var portInButton : array 0..(numInPins-1) of int

procedure buttonInBit0 (value: boolean)
portInState(0):= value
end buttonInBit0


portInButton(0) := GUI.CreateButton (425, 16, 0, "0", buttonInBit0)
....

When I try to run the program, it highlights "buttonInBit0" and the error says: "Argument is the wrong type"
I've done cut-n-paste on all the variable names so that I know there is no obvious spelling mistake.

What am I doing wrong.

Thanks,
Michael.

Author:  Insectoid [ Mon Feb 15, 2016 2:12 pm ]
Post subject:  RE:Help with button callback procedure

buttonInbit0 has a parameter, but you do not pass one to it when you call it inside GUI.CreateButton.


: