Not able to set background color

Not able to set background color

Postby Patrick Mast » Tue Oct 02, 2007 12:47 pm

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  Expand view
#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  Expand view
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
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Re: Not able to set background color

Postby Enrico Maria Giordano » Tue Oct 02, 2007 1:10 pm

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
Enrico Maria Giordano
 
Posts: 8374
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Not able to set background color

Postby Patrick Mast » Tue Oct 02, 2007 5:10 pm

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: 246
Joined: Sat Mar 03, 2007 8:42 pm


Postby Patrick Mast » Sun Oct 07, 2007 2:40 pm

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
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Antonio Linares » Sun Oct 07, 2007 5:40 pm

Patrick,

If you are going to use themes in your app, then you need to add these lines in your RC:
Code: Select all  Expand view
#ifdef __FLAT__
   1 24 "WindowsXP.Manifest"
#endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41401
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Sun Oct 07, 2007 6:24 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Sun Oct 07, 2007 7:06 pm

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
Antonio Linares
Site Admin
 
Posts: 41401
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Sun Oct 07, 2007 7:51 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Sun Oct 07, 2007 8:35 pm

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
Antonio Linares
Site Admin
 
Posts: 41401
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby RAMESHBABU » Mon Oct 08, 2007 3:28 am

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
User avatar
RAMESHBABU
 
Posts: 615
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 39 guests