
-----------------------------------
person
Mon Mar 06, 2006 9:08 pm

GUI
-----------------------------------
i found a problem with the turing GUI a long time ago, and thats the fact that parameters dont work for the procedures that are called
but now, i need to use parameters in my procedure

is there any way to get around this without making all my variables global?

-----------------------------------
Delos
Mon Mar 06, 2006 9:26 pm


-----------------------------------
person, you've been here long enough to know that vague allusions to problems you may have had in the past are by no means descriptive enough for anyone to help you with.
Please post some code.  Prefererably the part that is giving you the error.

Sounds to me that you're dealing with parameters declared in constant format, but passed in variable.  Though, if this were the case then you'd probably have gotten that error.  So until I see the code I won't be able to say more.

General heuristic:  Turing GUI sucks.  Make your own.

-----------------------------------
Cervantes
Mon Mar 06, 2006 10:37 pm


-----------------------------------
person, you've been here long enough to know that vague allusions to problems you may have had in the past are by no means descriptive enough for anyone to help you with.

Yes, but fortunately, his question is so old and common, so we can give a generic answer. :)

You can't pass parameters to your procedures because Turing's GUI's widgets use what we call "action procedures". They are procedures that take no parameters. Why do they take no parameters?  Because every button (every instance of the Button class) has to take the same value for the procedure. To Turing, a procedure that takes one parameter is as different from a procedure that takes no parameters as an int is from a string. They don't match.

Here's some example code to illustrate that.

proc hello_world
    put "Hello World"
end hello_world

proc hello (name : string)
    put "Hello " + name
end hello

var p, q : procedure p ()

% Set p to the hello_world procedure, which takes no parameters
p := hello_world

% Set q to the hello procedure, which takes one parameter
% This will produce an error, since q is defined as type
% procedure p ()
% (Removing the parentheses does nothing to aid us here)
q := hello ("Delos")

% Call the procedure stored in 'p'
p

% Call the procedure stored in 'q'
q


-----------------------------------
do_pete
Tue Mar 07, 2006 1:12 pm


-----------------------------------
Can't you just change Turing's GUI library to allow it to use parameters?

-----------------------------------
Dan
Tue Mar 07, 2006 3:00 pm


-----------------------------------
Yes in theroy you can beacuse there GUI sutff is open sorce. How ever if you do not inculde this newly moded GUI in all versons of turing you put your progame on it will not work.

-----------------------------------
person
Tue Mar 07, 2006 3:45 pm


-----------------------------------
so...do you know where I can download a modded version of the GUI or do i have to do it myself?
