Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / BBB GUI - Draw text

Author
Message
CodeTrasher
13
Years of Service
User Offline
Joined: 18th Jul 2012
Location: Tampere, Finland
Posted: 20th Feb 2015 12:41
Hi all,

this a simple question: how do I draw text when using BBB GUI plugin in a way that it has the same background color as the child view it is applied to?

I have tried to make it like this but it doesn't work:


Any suggestions how to get past this?
Admiral MH
15
Years of Service
User Offline
Joined: 10th Feb 2011
Location: TX, USA
Posted: 21st Feb 2015 07:41 Edited at: 24th Feb 2015 02:37
Hello CodeTrasher,

Unfortunately, the BBB GUI plugin does not provide that functionality. The 'BBB Draw_SetFillColor' command only changes the color for drawing shapes. In order to change the text foreground/background color, you have to make calls to the Win32/Windows API.

Calling the Windows API from DBPro is not that hard though. Here is a sample program with a function that can change the foreground/background color of the draw text.



Alternate version


Edit: Forgot to free memory allocations in code . Changed code snippet.
Edit2: Added alternate version without using Matrix1Utils.

CodeTrasher
13
Years of Service
User Offline
Joined: 18th Jul 2012
Location: Tampere, Finland
Posted: 23rd Feb 2015 10:05
Hi, and sorry for my late response!

Thank you very much for your answer, Admiral MH! I wasn't aware of this kind of possibility. I'm going to have a look at this later, but for now I'll cope with my text having white background It's not big of an issue, I was just wondering if it's possible to change the color using BBB commands.

But thanks again, your example snippet was very precise
Admiral MH
15
Years of Service
User Offline
Joined: 10th Feb 2011
Location: TX, USA
Posted: 23rd Feb 2015 19:45
Your welcome, glad to be of help. In case you do not want to use the memory allocation commands from Matrix1Utils plugins, the code can be rewritten using DBPro's memblocks commands (although using those commands would require mode code).

WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 23rd Feb 2015 21:14
Admiral MH, you can also do this with a user defined type array.
Admiral MH
15
Years of Service
User Offline
Joined: 10th Feb 2011
Location: TX, USA
Posted: 24th Feb 2015 02:36
Ah, I don't know why I did not think of that. Thanks for the tip WickedX .

Login to post a reply

Server time is: 2026-07-11 22:20:46
Your offset time is: 2026-07-11 22:20:46