QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: lawsonm1 on May 26, 2020, 09:43:38 pm
-
I have a program that pulls some stock prices from a website. I take the opening price as a base and then display it and the current price on the same line. Since things are displayed in USD, I use Print Using statement so I can get the value formatted properly, and I want it all on the same line. I'd like to be able to change the color of the 'current' value to red if the price goes down. I can't seem to find a way to change font color in the middle of a Print statement though. Here is a snippet of the code I use to display the line. I know it can probably be shortened, but this makes it easier for my pea brain to understand. Thanks, Mike
PRINT USING "$$#####.##";
(XYZcur
- XYZopen
);
'red if negative PRINT USING "$$#####.##";
((XYZcur
* XYZsh
) - (XYZpr
* XYZsh
)) 'red if negative
-
SCREEN 12 '<<<<<<<<<<<< set color according to screen setup XYZcur = 100
XYZopen = 200
IF (XYZcur
- XYZopen
) < 0 THEN COLOR 12 '<< red for screen 12 PRINT USING "$$#####.##";
(XYZcur
- XYZopen
);
'red if negative IF ((XYZcur
* XYZsh
) - (XYZpr
* XYZsh
)) < 0 THEN COLOR 12 '<< red for screen 12 PRINT USING "$$#####.##";
((XYZcur
* XYZsh
) - (XYZpr
* XYZsh
)) 'red if negative
-
Thanks bplus, I was trying to add the color change on the same line! der de der. I am so stoopid sometimes. I will try that in the morning. Mike
-
I made the changes this morning, and it has been working great. Thank you so much, Mike