Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 GUI.CreateTextFieldFull Help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
elmocookies




PostPosted: Wed Jan 03, 2007 3:52 pm   Post subject: GUI.CreateTextFieldFull Help

There arent any tutorials for this so I guess this is where I should be asking this. Does anyone know what the bolded areas are asking for?

GUI.CreateTextFieldFull (x, y, width : int, text : string, actionProc : procedure x (text : string),border, fontID, inputKind : int) : int

Thanks for your time.
Sponsor
Sponsor
Sponsor
sponsor
lord_pwnerer




PostPosted: Wed Jan 03, 2007 7:11 pm   Post subject: (No subject)

Yes.

(and yes I am in fact going to tell you)

The actionProc parameter specifies the name of the procedure to be called when the user presses ENTER. When it says in your slice of code there..

'actionProc : procedure x (text:string)'

it means that the procedure that you would replace that chunk of text with has to be (text : string)


As for the inputKind...

An input type of 0 is the default and is the same as GUI.ANY. GUI.ANY allows any type of input in the text field. GUI.INTEGER only allows positive integer input in the text field. GUI.REAL allows any real number input in the text field.

Next time, when you're in the Turing compiler, hit F10, it will take you to the documentation where you can look up these commands, it will also give you an example and some explanations.

Here's an example.

code:

import GUI
View.Set ("graphics:300;200, nobuttonbar")

var first_name, last_name : int   % The Text Fields variables.

procedure first_name_proc (text : string) %This will take place when the user hits enter after this text field is active
    GUI.SetSelection (last_name, 0, 0)
    GUI.SetActive (last_name)
end first_name_proc

procedure last_name_proc (text : string) %This will take place when the user hits enter after this text field is active
    GUI.SetSelection (first_name, 0, 0)
    GUI.SetActive (first_name)
end last_name_proc

%Declaring the first name textfield
first_name := GUI.CreateTextFieldFull (110, 120, 100, "",
    first_name_proc, GUI.INDENT, 0, 0)

%Declaring the last name textfield
last_name := GUI.CreateTextFieldFull (110, 90, 100, "",
    last_name_proc, GUI.INDENT, 0, 0)

%Creating labels for each textfield.
var nameLabel := GUI.CreateLabelFull (105, 120, "First Name", 0, 0,
    GUI.RIGHT, 0)
var addressLabel := GUI.CreateLabelFull (105, 90, "Last Name", 0, 0,
    GUI.RIGHT, 0)

loop
    exit when GUI.ProcessEvent
end loop



If you look at the code, you will notice that the procedure that takes place when you hit enter after the first text field, sets the second textfield active. And the procedure that takes place when you hit enter after the second text field, sets the first text field active.

The input type you can see is set at 0, this is because we're not limiting it to anything.

Remember, use the documentation.
elmocookies




PostPosted: Wed Jan 03, 2007 7:42 pm   Post subject: (No subject)

Thanks for helping. I did use the Turing Documentation, but it was confusing.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: