| Transparent get? 
 
	 
	
		| Author | Message |   
		| unknowngiver 
 
 
 
 
 | 
			
				|  Posted: Wed May 24, 2006 10:37 am    Post subject: Transparent get? |  |   
				| 
 |  
				| Hey I have a background on my game..and i used the Font.Draw function to draw text on the screen rather then PUT so my background will stay there and it wont put a white/other color where the text is
 
 but now i want to get users input...but when the user types something in...it makes the background [of the text] white
 is there anyway of doing it without it doing that??
 
 also
 
 i tried to do it with GUI text boxes but it doesnt work either...it gives me error on IMPORT GUI :S but if i run it as a seprate program it works :S and not in my program
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| Remm 
 
  
 
 
 | 
			
				|  Posted: Wed May 24, 2006 10:50 am    Post subject: (No subject) |  |   
				| 
 |  
				| You could use noecho in the Window.Open to get rid of the text entirely, or set the colourback ( without cls ) to somthing thats closer to the acual background. 
 OR
 
 after you type in the info, re-apply everything so the text goes away.
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| neufelni 
 
 
 
 
 | 
			
				|  Posted: Wed May 24, 2006 11:02 am    Post subject: (No subject) |  |   
				| 
 |  
				| You can acomplish this by putting noecho in your View.Set statement and then using Font.Draw for your input. Here is the code for it. 
 	  | code: |  	  |  
View.Set("noecho")
 
 var letter : string(1)
 var word : string := ""
 var font : int := Font.New("Arial:12")
 var word2 : string := ""
 
 loop
 getch (letter)
 cls
 exit when letter = KEY_ENTER
 if letter = KEY_BACKSPACE then
 for i : 1 .. length(word) - 1
 word2 := word2 + word(i)
 end for
 word := word2
 word2 := ""
 else
 word := word + letter
 end if
 Font.Draw(word, 0, 0, font, 7)
 end loop
 
 | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Delos 
 
  
 
 
 | 
			
				|  Posted: Wed May 24, 2006 1:49 pm    Post subject: Re: Transparent get? |  |   
				| 
 |  
				| unknowngiver wrote: Hey
I have a background on my game..and i used the Font.Draw function to draw text on the screen rather then PUT so my background will stay there and it wont put a white/other color where the text is
 
 but now i want to get users input...but when the user types something in...it makes the background [of the text] white
 is there anyway of doing it without it doing that??
 
 also
 
 i tried to do it with GUI text boxes but it doesnt work either...it gives me error on IMPORT GUI :S but if i run it as a seprate program it works :S and not in my program
 
 I don't recall if using 'getch' returns the value directly to the screen or not (there was one version of Turing where it didn't, and one where it did).  Either way, incorporating a well place ".." might solve your problem, as in:
 
 
 Otherwise, I would suggest incorporating the Font. idea posted above.  Looks a little prettier.  You should be aware, however, that getch() does have its limitations, and is prone to crashing if put in the hands of Users such as myself (who know secrets that crash Turing quite easily).
 
 As for the GUI import...is your import line the very first (or 2nd) line of code?  Post the specific error message, if you please.
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| unknowngiver 
 
 
 
 
 | 
			
				|  Posted: Wed May 24, 2006 9:08 pm    Post subject: (No subject) |  |   
				| 
 |  
				| i tried the it doesnt work.. is there any other way of doing it..without any vulanability..
 
 
 okay
 i got the import GUI thing working...but one problem
 the background for it is White..or w.e  set it..how can i make it transparent or an image...so it shows that image...rather then covering the whole screen with white???????
 this is how the register page looks So far [fine i am posting it :p ]
 
   
 i wnat the GUI form to be there...but when i put it i get a WHITE screen with that form..here is the code
 
 	  | code: |  	  | 
var nameTextField, addressTextField : int  % The Text Field IDs.
 
 procedure NameEntered (text : string)
 GUI.SetSelection (addressTextField, 0, 0)
 GUI.SetActive (addressTextField)
 end NameEntered
 
 procedure AddressEntered (text : string)
 GUI.SetSelection (nameTextField, 0, 0)
 GUI.SetActive (nameTextField)
 end AddressEntered
 
 
 var quitButton := GUI.CreateButton (52, 5, 100, "Quit", GUI.Quit)
 nameTextField := GUI.CreateTextFieldFull (50, 70, 100, "",
 NameEntered, GUI.INDENT, 0, 0)
 addressTextField := GUI.CreateTextFieldFull (50, 40, 100, "",
 AddressEntered, GUI.INDENT, 0, 0)
 var nameLabel := GUI.CreateLabelFull (45, 70, "Name", 0, 0,
 GUI.RIGHT, 0)
 var addressLabel := GUI.CreateLabelFull (45, 40, "Address", 0, 0,
 GUI.RIGHT, 0)
 loop
 exit when GUI.ProcessEvent
 end loop
 
 GUI.Dispose (quitButton)
 
 Text.Locate (maxrow - 1, 1)
 
 
 | 
 
 Thanks
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| TheOneTrueGod 
 
  
 
 
 | 
			
				|  Posted: Wed May 24, 2006 9:46 pm    Post subject: (No subject) |  |   
				| 
 |  
				| You could do a complex procedure, that takes getchar characters, concatenates them into a string, and draws that string onto the screen... come to think of it, it wouldn't be that complex... 
 	  | code: |  	  | 
procedure getName
 var ch : string(1)
 var theirName : string
 getchar(ch)
 if ch = " " then%I forgot the backspace key, and i'm too lazy to look it up.  You do it :P
 %Put in some error checking here.
 theirName := theirName(1..*-1)
 elsif ch = "ENTERKEY" %More not remembering stuff
 exit
 else
 theirName += ch
 end if
 end getName
 
 | 
 
 Kinda messy because of comments, but you should get the idea.  Just do checks and such, and possibly some output stuff, like drawind the background screen, and writing their name to the screen as they type it in, etc.  Good luck
  |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| unknowngiver 
 
 
 
 
 | 
			
				|  Posted: Wed May 24, 2006 10:09 pm    Post subject: (No subject) |  |   
				| 
 |  
				| TheOneTrueGod wrote: You could do a complex procedure, that takes getchar characters, concatenates them into a string, and draws that string onto the screen... come to think of it, it wouldn't be that complex...
 	  | code: |  	  | 
procedure getName
 var ch : string(1)
 var theirName : string
 getchar(ch)
 if ch = " " then%I forgot the backspace key, and i'm too lazy to look it up.  You do it :P
 %Put in some error checking here.
 theirName := theirName(1..*-1)
 elsif ch = "ENTERKEY" %More not remembering stuff
 exit
 else
 theirName += ch
 end if
 end getName
 
 | 
 
 Kinda messy because of comments, but you should get the idea.  Just do checks and such, and possibly some output stuff, like drawind the background screen, and writing their name to the screen as they type it in, etc.  Good luck
 thats wt nick posted..read my last post
  |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| TheOneTrueGod 
 
  
 
 
 | 
			
				|  Posted: Thu May 25, 2006 7:10 am    Post subject: (No subject) |  |   
				| 
 |  
				| lol, oops, must have missed that post  Sorry Nick.  Anyways, thats probably the best way to implement it.  I do believe that the getchar doesn't crash on inputs like CTRL-Z, but if you REALLY wanted complete crashlessness, you'd have to go with Input.KeyDown.  You would have to scan through ALL values possible with I.KD, and if one is pressed, then you would have to add it to the string.  Unfortunately, if someone is a very fast typer, this could screw them over a bit, because two keys pressed at once would be entered in alphabetical order  .  Go with whichever method you like. |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| unknowngiver 
 
 
 
 
 | 
			
				|  Posted: Thu May 25, 2006 9:23 am    Post subject: (No subject) |  |   
				| 
 |  
				| well i m still waiting for someone to help me with the GUI part..thats probably what i will use |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| TheOneTrueGod 
 
  
 
 
 | 
			
				|  Posted: Thu May 25, 2006 2:30 pm    Post subject: (No subject) |  |   
				| 
 |  
				| Er, I believe the best GUI is a custom GUI.  So, either create your own, which is the best option, or consult the Turing Walkthrough.  (if you havn't extensively)  Generally, the experts on this site would be experts in creating their own code, as opposed to using the limited (IMO) GUI stuff available.  The problem with using the predefined GUI stuff, is that you are limited to what the developer put in.  If its not in the turing help file, you probably can't do it. |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| unknowngiver 
 
 
 
 
 | 
			
				|  Posted: Thu May 25, 2006 3:11 pm    Post subject: (No subject) |  |   
				| 
 |  
				| well is there a tutorial that can guide me through on how to make my own GUI text box then?? i will willing to spend days constantly reading tutorials if i have 2 to do that :p but i cant find any resource to look at  |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| TheOneTrueGod 
 
  
 
 
 | 
			
				|  Posted: Thu May 25, 2006 4:32 pm    Post subject: (No subject) |  |   
				| 
 |  
				| Classes  or just use the method both myself and Nick posted, and it will be simulating your own GUI input. |  
				|  |  |   
		|  |  |  
	  
		|  |   
		|  |  
 |