dccheckbox appearance 2.0

This forum is for eXpress++ general support.
Message
Author
User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: dccheckbox appearance 2.0

#11 Post by Auge_Ohr »

Cliff Wiernik wrote:I enhanced the sample below per your requests ...
THX, that make it more clear that it is (again) a visual Style Problem with Xbase++ v2.x
Cliff Wiernik wrote:So it appears that something is not working properly for Xbase 2.0/Express with themes enabled and the :SetcolorBG() method versus the use of presentation parameters. This has been forwarded with a prior example to Andreas at Alaska and I will also provide Alaska Support with this example.

I do not know if the interaction of Express has anything to do with this as the same Express code is used for both versions.
Express++ is build on Xbase++ ... if Alaska have change something with visual Style and do not tell us ...

when build a native Checkbox ( Button ) using API and visual Style, without Ownerdraw, you can't set Background Color after Create

Code: Select all

@Gdi32:SetBkColor( hDC, AutomationTranslateColor(XBP* Color,.F.))
it is like XbpBrowse() using visual Style and o:Colorblock :(

with XbpBrowse() you can use Ownerdraw / o:customDrawCell Callback Slot but for Windows API you need a "Trick" when hook WM_CTLCOLORBTN / WM_CTLCOLORSTATIC Windows Message.

do you remember "black" Checkbox in Xbase++ Groupbox ?
it was the mistake of XBPSYSCLR_TRANSPARENT = -255 but Windows CLR_NONE are 0 using for

Code: Select all

::BrushSysColor :=  @Gdi32:CreateSolidBrush(CLR_NONE)
to use as Return Value of WM_CTLCOLORBTN / WM_CTLCOLORSTATIC

when using a Groupbox, which is a Static under Xbase++ , it also use { XBP_PP_BGCLR, -255 } when create by Formdesign ( Parent of Group ). thats why i wanted to see how it looks like without Groupbox.
btw. if you use Xbase++ v2.x Formdesign ... what will be the Result (Presentation-Parameter) ?

... and last Idea (now) : use oDialog:DrawingArea:SetColorBG() to see if it goes through the Child XbPart.
greetings by OHR
Jimmy

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: dccheckbox appearance 2.0

#12 Post by Cliff Wiernik »

I revised the same to use some pure Xbase++ objects. You can see that between 1.9 and 2.0 they do not behave the same. It is behaving different when the xbpcheckbox object is disabled.

Code: Select all

#include "dcdialog.ch"
LOCAL Getlist := {}, x := .T., oTabpage, ogroupbox, oXbp1, oXbp2


@ 0,0 dctabpage otabpage SIZE 30, 30 TABWIDTH 10 CAPTION 'Xbase++ 2.0'
dcsetparent to otabpage
@ 1,3 DCCHECKBOX  x prompt 'prompt1' color GRA_CLR_BLACK,XBPSYSCLR_TRANSPARENT
@ 2,3 DCCHECKBOX  x prompt 'prompt2'
@ 3,3 DCCHECKBOX  x prompt 'prompt3' color GRA_CLR_BLACK,XBPSYSCLR_TRANSPARENT WHEN {|| .F.}
@ 4,3 DCCHECKBOX  x prompt 'prompt4' WHEN {|| .F.}
@ 5,3 DCCHECKBOX  x prompt 'prompt5' PRESENTATION {{ XBP_PP_BGCLR, -255 }} WHEN {|| .F.}
@ 6,3 DCCHECKBOX  x prompt 'prompt6' EVAL {|o| o:SetColorBG(XBPSYSCLR_TRANSPARENT)} WHEN {|| .F.}
@ 7,3 DCCHECKBOX  x prompt 'prompt7' color GRA_CLR_BLACK,GRA_CLR_RED WHEN {|| .F.}
@ 8,3 DCCHECKBOX  x prompt 'prompt8' PRESENTATION {{ XBP_PP_BGCLR, GRA_CLR_RED }}
@ 9,3 DCCHECKBOX  x prompt 'prompt9' color GRA_CLR_BLACK,GRA_CLR_RED WHEN {|| .F.}
@ 10,3 DCCHECKBOX  x prompt 'prompt10' PRESENTATION {{ XBP_PP_BGCLR, GRA_CLR_RED }} WHEN {|| .F.}

@ 12,1 DCGROUP ogroupbox SIZE 20,14
dcsetparent to ogroupbox
@ 1,3 DCCHECKBOX  x prompt 'prompt1' color GRA_CLR_BLACK,XBPSYSCLR_TRANSPARENT
@ 2,3 DCCHECKBOX  x prompt 'prompt2'
@ 3,3 DCCHECKBOX  x prompt 'prompt3' color GRA_CLR_BLACK,XBPSYSCLR_TRANSPARENT WHEN {|| .F.}
@ 4,3 DCCHECKBOX  x prompt 'prompt4' WHEN {|| .F.}
@ 5,3 DCCHECKBOX  x prompt 'prompt5' PRESENTATION {{ XBP_PP_BGCLR, -255 }} WHEN {|| .F.}
@ 6,3 DCCHECKBOX  x prompt 'prompt6' EVAL {|o| o:SetColorBG(XBPSYSCLR_TRANSPARENT)} WHEN {|| .F.}
@ 7,3 DCCHECKBOX  x prompt 'prompt7' color GRA_CLR_BLACK,GRA_CLR_RED WHEN {|| .F.}
@ 8,3 DCCHECKBOX  x prompt 'prompt8' PRESENTATION {{ XBP_PP_BGCLR, GRA_CLR_RED }}
@ 9,3 DCCHECKBOX  x prompt 'prompt9' color GRA_CLR_BLACK,GRA_CLR_RED WHEN {|| .F.}
@ 10,3 DCCHECKBOX  x prompt 'prompt10' PRESENTATION {{ XBP_PP_BGCLR, GRA_CLR_RED }} WHEN {|| .F.}

dcread gui FIT ;
;//   eval {|o| oXbp1 := XbpCheckBox():new( ogroupbox, ogroupbox, {21,30}, {96,20}, { { XBP_PP_BGCLR, -255 } } ), ;
;//   eval {|o| oXbp1 := XbpCheckBox():new( ogroupbox, ogroupbox, {21,30}, {96,20}, { { XBP_PP_BGCLR, -255 } } ), ;
   eval {|o| oXbp1 := XbpCheckBox():new( ogroupbox, ogroupbox, {21,30}, {96,20}, { { XBP_PP_BGCLR, GRA_CLR_BACKGROUND } } ), ;
            oXbp1:caption := "xbpCheckbox11",       ;
            oXbp1:tabStop := .T.,              ;
            oXbp1:create(),                    ;
            oXbp1:selected := {|| NIL },       ;
            oXbp1:disable(),                   ;
;//            oXbp1:enable(),                    ;
                                               ;
;//            oXbp2 := XbpCheckBox():new( ogroupbox, ogroupbox, {21,10}, {96,20}, { { XBP_PP_BGCLR, -255 } } ), ;
            oXbp2 := XbpCheckBox():new( ogroupbox, ogroupbox, {21,10}, {96,20}  ), ;
;//            oXbp2 := XbpCheckBox():new( ogroupbox, ogroupbox, {21,10}, {96,20}, { { XBP_PP_BGCLR, GRA_CLR_BACKGROUND } } ), ;
            oXbp2:caption := "xbpCheckbox12",       ;
            oXbp2:tabStop := .T.,              ;
            oXbp2:setColorBG(GRA_CLR_BACKGROUND), ;
;//            oXbp2:setColorBG(XBPSYSCLR_TRANSPARENT), ;
            oXbp2:create(),                    ;
            oXbp2:selected := {|| NIL },       ;
            oXbp2:disable(),                   ;
;//            oXbp2:enable(),                    ;
                                               ;
                                               ;
                                               ;
            o:show()}


return
checkboxtest1-withpureXbase++object.jpg
checkboxtest1-withpureXbase++object.jpg (66.24 KiB) Viewed 7743 times

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dccheckbox appearance 2.0

#13 Post by rdonnay »

Here is a fix for you: _DCCLASS.PRG (line 1208)

WAS:

Code: Select all

DC_XbpSetColor( ::color, self, ::setParent(), ;
                  aGetListItem[aGETLIST_PRESENTATION], .t., .t. )
IS:

Code: Select all

IF Valtype(::color) $ 'ANB'
  DC_XbpSetColor( ::color, self, ::setParent(), ;
                  aGetListItem[aGETLIST_PRESENTATION], .t., .t. )
ELSE
  ::setColorBG(XBPSYSCLR_TRANSPARENT)
ENDIF
The eXpress train is coming - and it has more cars.

Dian
Posts: 21
Joined: Tue Feb 02, 2010 8:36 am
Location: Midland Texas

Re: dccheckbox appearance 2.0

#14 Post by Dian »

Thanks, Roger. That fixed the checkboxes. I also had to add the same lines in at 385 for the dc_XbpStatic, so that the background on Says for a code block would also be transparent.

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dccheckbox appearance 2.0

#15 Post by rdonnay »

I also had to add the same lines in at 385 for the dc_XbpStatic
I made that change too.
Both changes will be in the next build.
The eXpress train is coming - and it has more cars.

Post Reply