Not able to set background color

Post Reply
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Not able to set background color

Post by Patrick Mast »

Hello,

I'm unable to set background colors for SAY, RADIO and BITMAP controls.
I just tested it with latest xHarbour + latest FWH in Windows XP and Vista

Please try folowing sample:

Code: Select all

#include "FiveWin.ch"

#define CLR_WHITE      16777215

Function wfMain()
   LOCAL oDlg, oRadio, lRadio:=.F., oBitmap  
   
   DEFINE DIALOG oDlg NAME "TEST_DIALOG"    
   
   REDEFINE SAY ID 101 OF oDlg COLOR 0, CLR_WHITE         
   
   REDEFINE RADIO oRadio VAR lRadio ID 102 OF oDlg COLOR 0, CLR_WHITE    
   
   REDEFINE BITMAP oBitmap NAME "TERUG" ID 104 OF oDlg
   oBitmap:SetColor(0, CLR_WHITE)
                                  
   ACTIVATE DIALOG oDlg CENTERED
    
RETURN NIL
This is the RC:

Code: Select all

TEST_DIALOG DIALOG 21, 51, 271, 121
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Test Dialog"
FONT 8, "MS Sans Serif"
{
 LTEXT "Label on Dialog", 101, 12, 14, 78, 8
 CONTROL "", 104, "TBitmap", 0 | WS_CHILD | WS_VISIBLE | WS_BORDER, 16, 66, 48, 48
 CONTROL "Radio", 102, "BUTTON", BS_AUTORADIOBUTTON, 12, 35, 73, 12
}

TERUG         BITMAP TERUG.BMP
I have Zipped test.prg, Test.RC and Terug.BMP in Test-Background.zip which you can download here:
http://www.WinFakt.be/Downloads/Test-Background.zip

Thank you.

Patrick Mast
http://www.WinFakt.be
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Not able to set background color

Post by Enrico Maria Giordano »

Patrick, your sample work almost fine here using latest FWH. SAY and RADIO get the background color correctly while BITMAP doesn't.

EMG
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Re: Not able to set background color

Post by Patrick Mast »

EnricoMaria wrote:Patrick, your sample work almost fine here using latest FWH. SAY and RADIO get the background color correctly while BITMAP doesn't.
EMG
Hmm, strange. Can you try with xHarbour Builder please?

--
Patrick Mast
http://www.WinFakt.be
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Post by Patrick Mast »

Hello,

I just tried the sample with xHarbour for BCC (Latest build from CVS) and latest FWH, but I still get this result:

Image

I'm using latest Windows Vista.

Antonio, can you take a look please?

Thanks you.

Patrick Mast
http://www.winfakt.be
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Patrick,

If you are going to use themes in your app, then you need to add these lines in your RC:

Code: Select all

#ifdef __FLAT__
   1 24 "WindowsXP.Manifest" 
#endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Antonio,

>If you are going to use themes in your app, then you need to add these lines in your RC:

Could you explain this more. I never have used the #ifdef __FLAT__ condition. Is this so your program works properly with and without themes? What does FLAT signify?

James
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

James,

Borland RC compiler (and bcc32.exe too) provides the __FLAT__ define, so the resources editors will not include the file (as Borland resources workshop doesn't know how to manage it) but it will be compiled into the final RES and placed into the EXE

Its just a "trick" to bypass the RC editors, but include it in the final RES.

Also, as 16 bits doesn't provide __FLAT__ then the file is not included in the final RES 16 bits (as 16 bits apps don't support themes).

__FLAT__ stands for "flat" memory model (32 bits)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Antonio,

>Its just a "trick" to bypass the RC editors, but include it in the final RES.

I have been editing the RES file instead of the RC. Is there a problem with doing this? It seems to be working fine.

James
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

James,

>
I have been editing the RES file instead of the RC. Is there a problem with doing this? It seems to be working fine.
>

Thats fine too. I prefeer to use RC as it is ascii so you can use any tool like notepad, your source code editor, etc. to review it and modify it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post by RAMESHBABU »

Hello Patrick

Just add TRANSPARENT clause as under. You will get the expected
result in all versions of Windows. If you want the dialog to be
theme enabled, add the fillowing lines in your RC file.

#ifdef __FLAT__
1 24 "WindowsXP.Manifest"
#endif

DEFINE DIALOG oDlg NAME "TEST_DIALOG" TRANSPARENT

The output would be:

Image

- Ramesh Babu P
Post Reply