
-----------------------------------
MysticVegeta
Fri Jan 13, 2006 3:44 pm

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!

-----------------------------------
Tony
Fri Jan 13, 2006 7:06 pm


-----------------------------------
what's the code and error message in Widgetmodule.tu ?

-----------------------------------
MysticVegeta
Fri Jan 13, 2006 7:33 pm


-----------------------------------
ok this is taken directly from examples:
% 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
Sat Jan 14, 2006 12:40 pm


-----------------------------------
:lol: 

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
Sat Jan 14, 2006 1:57 pm


-----------------------------------
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  :lol: 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
Sat Jan 14, 2006 2:32 pm


-----------------------------------
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
Sat Jan 14, 2006 5:56 pm


-----------------------------------
Line 104: Deferred subroutine has not been resolved.

-----------------------------------
Cervantes
Sat Jan 14, 2006 6:05 pm


-----------------------------------
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)?

-----------------------------------
MysticVegeta
Sat Jan 14, 2006 8:18 pm


-----------------------------------
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
Sat Jan 14, 2006 11:25 pm


-----------------------------------
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
Sat Jan 14, 2006 11:28 pm


-----------------------------------
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 :)

-----------------------------------
MysticVegeta
Sun Jan 15, 2006 1:13 pm


-----------------------------------
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
Mon Jan 16, 2006 10:04 pm


-----------------------------------
Declare your text fields first, fixed it for me.

-----------------------------------
MysticVegeta
Mon Jan 16, 2006 10:31 pm


-----------------------------------
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....  :cry:

-----------------------------------
MysticVegeta
Tue Jan 17, 2006 5:45 pm


-----------------------------------
k I found another way, in your GUI.ProcessEvent loop, put
 
Input.KeyDown(yourKeyArray)

-----------------------------------
Unisyst
Mon Feb 13, 2006 11:54 pm


-----------------------------------
So the GUI.CreateTextBoxFull widget is uneditible? I was hoping to make a word processor.

-----------------------------------
MysticVegeta
Tue Feb 14, 2006 7:17 pm


-----------------------------------
#1: Look at the date on this topic. > 1 month, dont revive it
#2: Yes you can edit it if you have t3h 1337 5killz
