|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Topic # 1598 |
Text color |
06/11/2007 @ 03:18 by Trent
|
Hello, I am having fun writing some new programs in Izibasic. I am having a problem though with text color. I have looked everywhere but can't find examples of how to do it anywhere in the samples or forums. Here's what I would like to do. I would like the following line to be white on red background. In my old basic I would write it like this: color 15,4 Print "Hello" This doesn't work in Izibasic. Can someone please help me ? Thanks in advance. -trent-
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1 -------- 06/11/2007 @ 11:26 by Tuka
visitor |
Hello Trent,
Please try this code.
'RedMessage.iBAS {CreatorID "HELO"} {Version "1.0"} {PARSER ON} {KEYEVENTS ON} {CONSOLEFONT OFF} BEGIN SETFONT 7 R=65536*255 GPRINT "Hello!",65,70,R WAIT END |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2 -------- 06/11/2007 @ 11:46 by Tuka
visitor |
Hello Trent,
Please try this code. This program simplifies color select.
'iziColorSelect.iBAS {CreatorID "HELO"} {Version "1.0"} {PARSER ON} {KEYEVENTS ON} {CONSOLEFONT OFF}
BEGIN BUTTON #1,"Select",60,40,40,12 BOX 19,99 TO 141,151 B=COLOR(1) REPEAT E=DOEVENTS IF E=1 THEN C=COLORSELECT(255):C$=STR$(C,0) COLOR C:BOXFILLED 20,100 TO 140,150 COLOR B:GPRINT C$,60,60 END IF UNTIL E<0 END
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 3 -------- 06/11/2007 @ 12:04 by Tuka
visitor |
Hello,
I upgraded iziColorSelect. I'm sorry by my many answer.
'iziColorSelect.iBAS {CreatorID "HELO"} {Version "1.0"} {PARSER ON} {CONSOLEFONT OFF}
BEGIN BUTTON #1,"Select",60,40,40,12 BOX 19,99 TO 141,151 B=COLOR(1):C=255 REPEAT E=DOEVENTS IF E=1 THEN C=COLORSELECT(C):C$=STR$(C,0) COLOR C:BOXFILLED 20,100 TO 140,150 COLOR B:GPRINT C$,60,60 END IF UNTIL E<0 END |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 4 -------- 10/11/2007 @ 02:20 by Trent
visitor |
Tuka, Thankyou for your replies. I typed in your upgraded example called IziColorSelect.ibas and ran it. It runs very nicely. It's a neat program. But it still doesn't show me an example of how to just write some simple color text on color background. Simply put, how can I make the following text to be white on red background ? "Hello". In standard basic it would be simply:
Color 15,4 Pring "Hello"
Thanks for your hard work. -trent-
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 5 -------- 10/11/2007 @ 02:26 by Trent
visitor |
Tuka, Sorry for the typing/spelling error on my previous message. Should have said: PrinT "Hello" not PrinG "Hello"
You probably figured that out on your own, but it seems that we may have a language barrier between us and when I make spelling mistakes it just makes it worse. Thanks again. <smile> -trent- |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 6 -------- 10/11/2007 @ 02:57 by Tuka
visitor |
Hello Trent,
We use GPRINT statement. GPRINT supported colorful message. Please watch this sample and the other samples which I already introduced.
'ColorMSG.iBAS {CreatorID "HELO"} {Version "1.0"} {PARSER ON} {CONSOLEFONT OFF}
BEGIN BOXFILLED 40,40 TO 100,90 W=65536*255+256*255+255 'WHITE R=16711680 'RED =65536*255 GPRINT "Hello",60,60,R,W WAIT END |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 7 -------- 10/11/2007 @ 03:10 by Tuka
visitor |
Hello Trent,
I'm sorry. I made a mistake. This sample displays a white message in a red background.
'ColorMSG.iBAS {CreatorID "HELO"} {Version "1.0"} {PARSER ON} {CONSOLEFONT OFF}
BEGIN W=65536*255+256*255+255 'WHITE R=16711680 'RED =65536*255 GPRINT "Hello",60,60,W,R WAIT END |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 8 -------- 12/11/2007 @ 01:46 by Trent
visitor |
Hi Tuka, Thanks for the quick reply. I ran your program and it comes up with violet letters on red background. That's OK. I am starting to understand the color calls now except how do you know what the correct numbers are for the various colors when writing programs? How did you know red is and white is? Where are these numbers written down in correlation to the colors? Where did you get W=65536*255+256*255+255'White RED=65536*255 ? Thanks, -trent-
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 9 -------- 12/11/2007 @ 13:53 by Tuka
visitor |
Hello Trent,
Please read explanation of COLOR in the user manual. I calculate the color code in an expression written there.
COLOR v|n Sets the pen color to the v|n value Note: - in black & white screen mode, v|n is 0 (white) or 1 (black) - in other screen modes, v|n = Red x 65536 + Green x 256 + Blue, where Red,Green and Blue are [0..255] gradients
It is hard to make trial and error in this expression. Therefore I get a color code with iziColorSelect. Please choose RGB in the select screen of iziColorSelect. You may change a color with a slider.
|
|
|
topic active
topic closed
Sticky
New message -
Correct message
Close topic
Make sticky
|
|