1. [DOS] How to set different text_colors?
- Posted by Sunraysia Psychiatric Centre <sunpsych at MILDURA.NET.AU> Nov 06, 2000
- 439 views
I'd be grateful for advice on coding to do achieve the following... 1 display a prompt message in, say, yellow (eg: "Enter something here: ") 2 echo user's response on screen in, say, green (eg "This is user's input") I've tried this, but can't get the green colour: ...... text_color( YELLOW ) puts( 1, "Enter something here: " ) text_color( GREEN ) user_input = gets( 0 ) ...... Thank you Alex Caracatsanis
2. Re: [DOS] How to set different text_colors?
- Posted by Euman <euman at BELLSOUTH.NET> Nov 05, 2000
- 415 views
- Last edited Nov 06, 2000
I think the below code is what your after, I also would point you to EE Editor by David Cuny EE has a .e file named keys.e that will allow to get the key press number so you can specify what key will take you out of the loop.. Good Luck! euman at bellsouth.net --BEGIN CODE include graphics.e constant SCREEN = 1, TRUE = 1, ENTER = 13 procedure user_input() -- get user input from keyboard ---modified by Euman for example object key while TRUE do key = get_key() if key = ENTER then exit end if if key = -1 then else text_color( GREEN ) puts(SCREEN, key) end if end while end procedure text_color( YELLOW ) puts( 1, "Enter something here: " ) user_input() -- END CODE ----- Original Message ----- From: "Sunraysia Psychiatric Centre" <sunpsych at MILDURA.NET.AU> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Sunday, November 05, 2000 10:11 PM Subject: [DOS] How to set different text_colors? > I'd be grateful for advice on coding to do achieve the following... > 1 display a prompt message in, say, yellow (eg: "Enter something here: > ") > 2 echo user's response on screen in, say, green (eg "This is user's > input") > > I've tried this, but can't get the green colour: > ...... > text_color( YELLOW ) > puts( 1, "Enter something here: " ) > text_color( GREEN ) > user_input = gets( 0 ) > ...... > > Thank you > > Alex Caracatsanis >
3. Re: [DOS] How to set different text_colors?
- Posted by Asif Baloch <cyberego at QTA.PAKNET.COM.PK> Nov 06, 2000
- 422 views
If you want to have user response integrated then you have to use get.e lib. For example, if you want your code to prompt for a number that will be used to show color then you can write a function or the easiest way to do it i.e, if u r beginner is the following methed. I call it looping-around : ;) include get.e integer num1 puts(1, "The simplest code ever\n") num1 = prompt_number("Enter a number for my code\n", {}) if num1 = 1 then text_color(1) elsif num1 = 2 then text_color(2) ..... ..... this goes on till your code is full of lines and lines of loops. But as i said before ;integration' is the key. Write a function, thats the best way dear. -Hope this helps Asif Baloch MBA (Information Technology) BBA (CBIS)
4. Re: [DOS] How to set different text_colors?
- Posted by Asif Baloch <cyberego at QTA.PAKNET.COM.PK> Nov 06, 2000
- 441 views
The best way to use different colors is to first include graphics.e lib and then use the following: text_color(1) -- 1 represents a color, 2 ,3,4,5 can all be used. TO change the background color, use this : bk_color(2) -- 2 can be any valid color number -Hope this helps Asif Baloch MBA (Information Technology) BBA (CBIS)
5. Re: [DOS] How to set different text_colors?
- Posted by Euman <euman at BELLSOUTH.NET> Nov 06, 2000
- 441 views
Asif, I would like to see the code that answers Sunraysia's question written as you've described below that produces the same effect that the example I posted gives. euman at bellsouth.net ----- Original Message ----- From: "Asif Baloch" <cyberego at QTA.PAKNET.COM.PK> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Monday, November 06, 2000 12:17 AM Subject: Re: [DOS] How to set different text_colors? > The best way to use different colors is to first include graphics.e lib and > then use the following: > > text_color(1) -- 1 represents a color, 2 ,3,4,5 can all be used. > TO change the background color, use this : > bk_color(2) -- 2 can be any valid color number > > -Hope this helps > > Asif Baloch > MBA (Information Technology) > BBA (CBIS) >
6. Re: [DOS] How to set different text_colors?
- Posted by "Thomas Parslow (PatRat)" <patrat at rat-software.com> Nov 06, 2000
- 437 views
> I'd be grateful for advice on coding to do achieve the following... > 1 display a prompt message in, say, yellow (eg: "Enter something here: > ") > 2 echo user's response on screen in, say, green (eg "This is user's > input") > > I've tried this, but can't get the green colour: > ...... > text_color( YELLOW ) > puts( 1, "Enter something here: " ) > text_color( GREEN ) > user_input = gets( 0 ) > ...... > > Thank you > > Alex Caracatsanis Hi, If you set the text color to GREEN then puts spaces over the place where the user is going to enter the text then you should get the effect you want: -------------------------------------------------- include graphics.e function ColoredGets(atom color) sequence StartPos,VideoConfig --Ok, first find out where we're starting from StartPos = get_position() --Now find out how many colums there are in total VideoConfig = video_config() --Set the text color text_color(color) --Fill the space where the user will be making they're input with spaces of that color --If you want the input to be longer than to the end of the line then increas the length here puts(1,repeat(' ',VideoConfig[VC_COLUMNS]-StartPos[2]+1)) --Set the cursor position back to the original location position(StartPos[1],StartPos[2]) --get input and return return gets(0) end function sequence user_input text_color( YELLOW ) puts( 1, "Enter something here: " ) user_input = ColoredGets( GREEN ) -------------------------------------------------- Hope this helps :) Thomas Parslow (PatRat) ICQ #:26359483 Rat Software http://www.rat-software.com/ Please leave quoted text in place when replying