setting font on Group Box

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

Post 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 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post 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.
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
   ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post 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:

Image
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post 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
Image


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,

:twisted:
Last edited by fraxzi on Sat Nov 29, 2008 9:30 am, edited 2 times in total.
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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...
regards, saludos

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

Post 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 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post 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.
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post by fraxzi »

Mr. Antonio,


Any development?


Regards
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post 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

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:

Image
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Post Reply