Page 1 of 1

Not able to set background color

Posted: Tue Oct 02, 2007 12:47 pm
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

Re: Not able to set background color

Posted: Tue Oct 02, 2007 1:10 pm
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

Re: Not able to set background color

Posted: Tue Oct 02, 2007 5:10 pm
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

Re: Not able to set background color

Posted: Tue Oct 02, 2007 9:20 pm
by Enrico Maria Giordano
No, sorry.

EMG

Posted: Sun Oct 07, 2007 2:40 pm
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

Posted: Sun Oct 07, 2007 5:40 pm
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

Posted: Sun Oct 07, 2007 6:24 pm
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

Posted: Sun Oct 07, 2007 7:06 pm
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)

Posted: Sun Oct 07, 2007 7:51 pm
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

Posted: Sun Oct 07, 2007 8:35 pm
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

Posted: Mon Oct 08, 2007 3:28 am
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