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

Username:   Password: 
 RegisterRegister   
 text field
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jrok311




PostPosted: Sat Apr 30, 2005 10:43 pm   Post subject: text field

Is it possible in turing to make a text field more like a text box so that the user can have more than one line to type things on? Also is there a way to extract the text typed into the text field and use it later? For example if the user types in "name", can the word "name" can be used in a put statement later on? If this is possible, will this work with full sentences as well? Thanks
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sun May 01, 2005 7:33 am   Post subject: (No subject)

Are you talking about Turing's built-in GUI or making your own?
jrok311




PostPosted: Sun May 01, 2005 11:40 am   Post subject: reply

I was talking about turing's built in gui textfield, but if there is a way I can make my own that will do want I need it to do then that is fine also.
jrok311




PostPosted: Sun May 01, 2005 3:41 pm   Post subject: reply

I found out how to get the text used in the text field and use it where I need it but I still have my other questions from before like can the size of the field be changed? I also have a new question now, is there a way to clear the text field after the user presses enter?
Cervantes




PostPosted: Sun May 01, 2005 3:49 pm   Post subject: (No subject)

Check the help file for GUI.CreateTextBox. Also, if you want to make your own, it's not too difficult, though you'll need some pretty good programming skills. Knowing how to make your own classes would be especially useful. All in all, making one would require checking to see if it's clicked and checking for input (and certain keys such as the arrows, enter, delete, backspace, home, end, pg up, and pg down.), text wrapping, and scrolling.
jrok311




PostPosted: Sun May 01, 2005 3:57 pm   Post subject: reply

The problem with the text box is that it seems to me that it can only be used for output and the user cannot edit its contents, unless there is away around this...
jrok311




PostPosted: Sun May 01, 2005 5:38 pm   Post subject: reply

I am satisfied with the way I have the textboxes now but I just need to make it so that the text field gets cleared after you type something in it and so that all of the things that are in the textbow don't get erased when that happens. Here is my code so you can see what I mean. Thanks

code:

import GUI in "%oot/lib/GUI"
View.Set ("graphics:500;500, nobuttonbar")
colourback (black)
cls
colour (white)

forward proc main

var fileNameToBeViewed : string
var messagearea : int

procedure messageentered (text : string)
    % put GUI.GetText (messagearea)
    fileNameToBeViewed := GUI.GetText (messagearea)
    main
end messageentered

messagearea := GUI.CreateTextFieldFull (10, 10, 480, "", messageentered, GUI.INDENT, 0, 0)

body proc main
    % The Text Field ID
    var textBox : int

    % Create the text box.
    textBox := GUI.CreateTextBoxFull (10, 40, 400, 300, GUI.INDENT, 0)
    GUI.AddLine (textBox, fileNameToBeViewed)
end main

loop
    exit when GUI.ProcessEvent
end loop
Cervantes




PostPosted: Sun May 01, 2005 7:39 pm   Post subject: (No subject)

I believe the problem is that every time you enter text from the text field you reset the text box. That's not what you want. You just want to add a line.

Turing:

import GUI in "%oot/lib/GUI"
View.Set ("graphics:500;500, nobuttonbar")
colourback (black)
cls
colour (white)


var fileNameToBeViewed : string
var messagearea : int
var textBox : int

procedure messageentered (text : string)
    % put GUI.GetText (messagearea)
    fileNameToBeViewed := GUI.GetText (messagearea)
    GUI.AddLine (textBox, fileNameToBeViewed)
end messageentered

messagearea := GUI.CreateTextFieldFull (10, 10, 480, "", messageentered, GUI.INDENT, 0, 0)
textBox := GUI.CreateTextBoxFull (10, 40, 400, 300, GUI.INDENT, 0)


loop
    exit when GUI.ProcessEvent
end loop
Sponsor
Sponsor
Sponsor
sponsor
jrok311




PostPosted: Sun May 01, 2005 8:01 pm   Post subject: reply

Ok, thanks that helps a lot. Now there is just the thing about clearing the text field after you press enter to clear it every time. Thanks
Cervantes




PostPosted: Sun May 01, 2005 8:09 pm   Post subject: (No subject)

updated procedure:
Turing:

procedure messageentered (text : string)
    % put GUI.GetText (messagearea)
    fileNameToBeViewed := GUI.GetText (messagearea)
    GUI.AddLine (textBox, fileNameToBeViewed)
    GUI.SetText (messagearea, "")
end messageentered
jrok311




PostPosted: Sun May 01, 2005 11:00 pm   Post subject: (No subject)

Thanks for all the help
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  [ 11 Posts ]
Jump to:   


Style:  
Search: