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

Username:   Password: 
 RegisterRegister   
 Keystrokes error in textboxes
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MysticVegeta




PostPosted: Fri Jan 13, 2006 3:44 pm   Post subject: Keystrokes error in textboxes

If we create a textbox and press any keystroke while executing the program. It will crash. WHY?! Widgetmodule.tu comes up and highlights the error. omg, I want it so that if you press any keystroke, it wont crash!
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Jan 13, 2006 7:06 pm   Post subject: (No subject)

what's the code and error message in Widgetmodule.tu ?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
MysticVegeta




PostPosted: Fri Jan 13, 2006 7:33 pm   Post subject: (No subject)

ok this is taken directly from examples:
code:
% The "GUI.CreateTextBoxFull" program.
import GUI
View.Set ("graphics:300;300")

const fileNameToBeViewed : string := "%oot/support/help/Examples/GUI.CreateTextBoxFull.t"
var textBox : int           % The Text Field ID.
var title : int             % The label for the title.
var f : int                 % The stream number of the file.
var line : string           % Lines to be read from the file.

% Open the file.
open : f, fileNameToBeViewed, get
if f = 0 then
    put "Unable to open " + fileNameToBeViewed + " : ", Error.LastMsg
    return
end if

% Set background color to gray for indented text box.
GUI.SetBackgroundColor (gray)

% Create the title label and text box.
title := GUI.CreateLabelFull (20, 280, fileNameToBeViewed, 250, 0,
    GUI.CENTER, 0)
textBox := GUI.CreateTextBoxFull (10, 10, 280, 265,
    GUI.INDENT, 0)

% Read the file and place it in the text box.
GUI.SetScrollOnAdd (textBox, false)
loop
    exit when eof (f)
    get : f, line : *
    GUI.AddLine (textBox, line)
end loop

close : f           % Close the file.

loop
    exit when GUI.ProcessEvent
end loop


press any key whenyou run it
Delos




PostPosted: Sat Jan 14, 2006 12:40 pm   Post subject: (No subject)

Laughing

Yeah, this one pops up every now and again. If I recall correctly this is a problem with the GUI module itself and not really something you'll want to try and fix. Unless you really want to wade through the Widget module!

I think Cervantes came up with a solution to this a while back, or did he just create a new one altogether. There's an idea! (Albeit one that I frequently suggest). Turing's GUI sucks, with a capital 'H'. Make your own GUI if you need it, it will be more compact, more efficient, more tailored to your own needs, and will result in a smaller file size.
MysticVegeta




PostPosted: Sat Jan 14, 2006 1:57 pm   Post subject: (No subject)

I just commented a line in the widgetmodule.tu and the error doesn't appear but I know it will occur someplace else because thats the reason they put the line there lol Laughing Anyways, If I edit "my" widgetmodule and then compile my file in exe and distribute, will it cause an error in the other person's computer?
Cervantes




PostPosted: Sat Jan 14, 2006 2:32 pm   Post subject: (No subject)

Once you compile the .exe, it's no longer running via Turing. Changing your predefs or GUI libraries will not affect them on other computers when running your .exe.

You still haven't answered Tony's question, by the way, which will make it easier for us to help you.
MysticVegeta




PostPosted: Sat Jan 14, 2006 5:56 pm   Post subject: (No subject)

Line 104: Deferred subroutine has not been resolved.
Cervantes




PostPosted: Sat Jan 14, 2006 6:05 pm   Post subject: (No subject)

What's the subroutine? (What's the procedure/function called?)

What happens if you try to resolve it with an empty procedure (or perhaps a function that returns 0, false, or a null string, depending on what it's looking for)?
Sponsor
Sponsor
Sponsor
sponsor
MysticVegeta




PostPosted: Sat Jan 14, 2006 8:18 pm   Post subject: (No subject)

Why dont you try the code I posted above and run it and press a key... You can understand it way better than me :S
Cervantes




PostPosted: Sat Jan 14, 2006 11:25 pm   Post subject: (No subject)

Because I don't have the linux version of Turing, and WINEing it would probably cause it to crash before the error you're describing occurs.
MysticVegeta




PostPosted: Sat Jan 14, 2006 11:28 pm   Post subject: (No subject)

So could someone else do it? Because if I comment the line, I want to make sure that it doesnt interfere anywhere else, or what I will do is comment the line, save it, compile exe and uncomment it again, that way everything stays perfect Smile
MysticVegeta




PostPosted: Sun Jan 15, 2006 1:13 pm   Post subject: (No subject)

ohh I think I figured it out, it disables the keystrokes made by the user if I comment that line. For eg: I have a widget that is set as default (true) so when I press enter it activates, now If I comment that line, I am able to get rid of the error but the keys become useless but I guess I will do it for that program only because I dont think I need keystrokes anywhere else in the program...

Suggestions?
GhostCobra




PostPosted: Mon Jan 16, 2006 10:04 pm   Post subject: (No subject)

Declare your text fields first, fixed it for me.
MysticVegeta




PostPosted: Mon Jan 16, 2006 10:31 pm   Post subject: (No subject)

Oh I get it, if you declare the box before you change any properties of the window, the keystrokes wont give an error, but if your program does require to change windows, we have to do it my way.... Crying or Very sad
MysticVegeta




PostPosted: Tue Jan 17, 2006 5:45 pm   Post subject: (No subject)

k I found another way, in your GUI.ProcessEvent loop, put
code:

Input.KeyDown(yourKeyArray)
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 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: