Page 2 of 2
Posted: Sat Nov 29, 2008 8:28 am
by Antonio Linares
This is working fine:
Code: Select all
#include "FiveWin.ch"
function Main()
local oFnt, oFnt2, oDlg, oFld, oGrp
DEFINE FONT oFnt NAME "Verdana" SIZE 0, -16 BOLD
DEFINE FONT oFnt2 NAME "Arial" SIZE 0, -10
DEFINE DIALOG oDlg SIZE 400, 300 FONT oFnt
@ 0.5, 1 FOLDER oFld OF oDlg SIZE 188, 138 ;
PROMPTS "One", "Two", "Three"
@ 1, 1 GROUP oGrp TO 5, 15 PROMPT "Test" OF oFld:aDialogs[ 1 ]
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT oGrp:SetFont( oFnt2 )
return nil
Should I add themes manifest to it ?
Posted: Sat Nov 29, 2008 8:29 am
by fraxzi
OK! Lets try and solve this..
I will build this example and post results..
ASAP.
The dialog should be redefined from .RC and themed.
Posted: Sat Nov 29, 2008 8:35 am
by Antonio Linares
Ok, using themes we can reproduce the problem.
First change required is this line in Class TControl:
Code: Select all
METHOD Colors( hDC ) CLASS TControl
...
else
if IsAppThemed() .and. Upper( ::ClassName() ) $ "TCHECKBOX;TRADIO;TGROUP" // changed!
DrawPBack( ::hWnd, hDC )
endif
endif
...
Posted: Sat Nov 29, 2008 8:37 am
by fraxzi
Code: Select all
#include "FiveWin.ch"
function Main()
local oFnt, oDlg, oFld, oGrp
local oFnt2
DEFINE FONT oFnt NAME "Verdana" SIZE 0, -16 BOLD
DEFINE FONT oFnt2 NAME "Verdana" SIZE 0, -12
DEFINE DIALOG oDlg SIZE 400, 300 FONT oFnt
@ 0.5, 1 FOLDER oFld OF oDlg SIZE 188, 138 ;
PROMPTS "One", "Two", "Three"
@ 1, 1 GROUP oGrp TO 5, 15 PROMPT "Test" OF oFld:aDialogs[ 1 ]
ACTIVATE DIALOG oDlg CENTERED;
ON INIT oGrp:SetFont( oFnt2 )
return nil
This is true and correct:
Posted: Sat Nov 29, 2008 8:47 am
by Antonio Linares
Frances,
Are you using themes there ?
It does not work fine in Vista when using themes
It looks like a Windows bug with groups and themes. We need to find a workaround for this...
Posted: Sat Nov 29, 2008 9:17 am
by fraxzi
Yes.
Here's the sample codes (
EXPANDED)
.PRG
Code: Select all
#include "FiveWin.ch"
function Main()
local oFnt, oDlg, oFld, oGrp
local oFnt2
DEFINE FONT oFnt NAME "Verdana" SIZE 0, -16 BOLD
DEFINE FONT oFnt2 NAME "Verdana" SIZE 0, -12
DEFINE DIALOG oDlg FONT oFnt RESOURCE 'TRY_DLG'
REDEFINE FOLDER oFld ID 903 OF oDlg;
PROMPTS "One", "Two", "Three";
DIALOGS 'GRP_DLG','BLANK_DLG','BLANK_DLG';
FONT oFnt
ACTIVATE DIALOG oDlg CENTERED;
ON INIT oFld:aDialogs[1]:SetFont( oFnt2 )
return nil
.RC
Code: Select all
1 MANIFEST "xpman.xml"
TRY_DLG DIALOG 1, 1, 160, 111
STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU
{
CONTROL "", 903, "SysTabControl32", 0 | WS_CHILD | WS_VISIBLE, 5, 7, 149, 100
}
GRP_DLG DIALOG 1, 1, 99, 51
STYLE WS_CHILD | WS_CLIPCHILDREN
{
GROUPBOX "Group", 101, 6, 7, 85, 34, BS_GROUPBOX
}
BLANK_DLG DIALOG 1, 1, 95, 61
STYLE WS_CHILD | WS_SYSMENU
{
}
RESULTS
That's the problem there. The groupbox should be of different font against the font of TFolder.
I hope we can make some workaround.. Vista is not my concern.. Only XP.
Best regards,
Posted: Sat Nov 29, 2008 9:21 am
by Antonio Linares
Frances,
I have tried to set the hroupbox font from Class TControl Method Colors() but without success...
Colors() is called just before painting the control, and even there a WM_SETFONT msg is not properly processed. Strange...
Posted: Sat Nov 29, 2008 9:24 am
by Antonio Linares
This fails too:
Code: Select all
#include "FiveWin.ch"
function Main()
local oFnt, oFnt2, oDlg, oFld, oGrp
DEFINE FONT oFnt NAME "Verdana" SIZE 0, -16 BOLD
DEFINE FONT oFnt2 NAME "Arial" SIZE 0, -10
DEFINE DIALOG oDlg SIZE 400, 300 FONT oFnt
@ 0.5, 1 FOLDER oFld OF oDlg SIZE 188, 138 ;
PROMPTS "One", "Two", "Three"
@ 1, 1 GROUP oGrp TO 5, 15 PROMPT "Test" OF oFld:aDialogs[ 1 ] FONT oFnt2
@ 5, 1 BUTTON "font" OF oFld:aDialogs[ 1 ] ACTION oGrp:SelFont()
ACTIVATE DIALOG oDlg CENTERED
return nil
Posted: Sat Nov 29, 2008 9:28 am
by fraxzi
Antonio Linares wrote:This fails too:
Code: Select all
#include "FiveWin.ch"
function Main()
local oFnt, oFnt2, oDlg, oFld, oGrp
DEFINE FONT oFnt NAME "Verdana" SIZE 0, -16 BOLD
DEFINE FONT oFnt2 NAME "Arial" SIZE 0, -10
DEFINE DIALOG oDlg SIZE 400, 300 FONT oFnt
@ 0.5, 1 FOLDER oFld OF oDlg SIZE 188, 138 ;
PROMPTS "One", "Two", "Three"
@ 1, 1 GROUP oGrp TO 5, 15 PROMPT "Test" OF oFld:aDialogs[ 1 ] FONT oFnt2
@ 5, 1 BUTTON "font" OF oFld:aDialogs[ 1 ] ACTION oGrp:SelFont()
ACTIVATE DIALOG oDlg CENTERED
return nil
This works good.. same as the first example. Please try the (
EXPANDED) sample.
Posted: Tue Dec 02, 2008 2:18 am
by fraxzi
Mr. Antonio,
Any development?
Regards
Posted: Tue Dec 02, 2008 8:41 am
by Antonio Linares
Frances,
No, sorry, nothing yet. It seems as a Windows theme bug and we need to find a workaround.
Setting the right font from Method Colors() should be enough, but it does not work.
Posted: Thu Dec 04, 2008 2:18 am
by fraxzi
SOLVED!!!! - workaround
Mr. Antonio,
I put this:
Code: Select all
...
ON INIT oFld:aDialogs[2]:bEraseBkGnd := { | hDC | DrawPBack( oFld:hWnd, hDC ), 1 }
...
OR
Code: Select all
...
ON INIT oFld:aDialogs[2]:bEraseBkGnd := Nil
...
oFld:aDialogs[2] is the container of redefined dialog with redefined groupbox
oFld:hWnd is the handle of redefined folder
Please look at the image
This bug must be solved in the future
Observation: Noticed the folder color!? it turns to plain and not themed....
I added this:
Code: Select all
...
REDEFINE FOLDER oFld ...
COLOR CLR_BLACK, RGB(252,252,254)
...
Result: