Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10494 > unrolled thread

Groupbox set complete box background color

Started bySherlock <sherlock@sherlock.com.au>
First post2017-04-25 22:18 -0700
Last post2017-04-29 09:10 +0200
Articles 9 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Groupbox set complete box background color Sherlock <sherlock@sherlock.com.au> - 2017-04-25 22:18 -0700
    Re: Groupbox set complete box background color "Karl-Heinz" <invalid@invalid.invalid> - 2017-04-26 12:53 +0200
      Re: Groupbox set complete box background color Sherlock <sherlock@sherlock.com.au> - 2017-04-26 05:03 -0700
      Re: Groupbox set complete box background color "Jamal" <noooospam@example.com> - 2017-04-26 11:59 -0400
        Re: Groupbox set complete box background color "Karl-Heinz" <invalid@invalid.invalid> - 2017-04-26 18:45 +0200
          Re: Groupbox set complete box background color "Jamal" <noooospam@example.com> - 2017-04-26 14:34 -0400
            Re: Groupbox set complete box background color "Karl-Heinz" <invalid@invalid.invalid> - 2017-04-28 08:44 +0200
              Re: Groupbox set complete box background color "Jamal" <noooospam@example.com> - 2017-04-28 13:01 -0400
                Re: Groupbox set complete box background color "Karl-Heinz" <invalid@invalid.invalid> - 2017-04-29 09:10 +0200

#10494 — Groupbox set complete box background color

FromSherlock <sherlock@sherlock.com.au>
Date2017-04-25 22:18 -0700
SubjectGroupbox set complete box background color
Message-ID<4a5f8aa2-e94a-4bbd-a393-14e7fff2478f@googlegroups.com>
VO'ers

Remind me there has to be a simple way to set the color for the Groupbox total area, not just where the text appears in the groupbox caption.

Technique please.

Phnil

[toc] | [next] | [standalone]


#10495

From"Karl-Heinz" <invalid@invalid.invalid>
Date2017-04-26 12:53 +0200
Message-ID<embcifFmq1iU1@mid.individual.net>
In reply to#10494
Hi Phil,

>
> Remind me there has to be a simple way to set the color for the Groupbox
> total area,
>

That makes only sense when you want to fill  the groupbox with a different
owner window color, right ?  But there´s IMHO no simple way to do that.
Here´s a link to a completely self drawn GroupBox.

www.rauscher-software.de/downloads/ODGroupBox.aef

Just play with the Groupbox and Window Background color settings and you´ll
see if it fits your needs. You´ll also see a slightly difference when you
active/deactivate the manifest.

regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#10496

FromSherlock <sherlock@sherlock.com.au>
Date2017-04-26 05:03 -0700
Message-ID<d35c0308-6128-4861-86b3-c2e087dccd30@googlegroups.com>
In reply to#10495
Karl..

Thanks will look at it..  Interested to see the technique.
I actually hacked a working solution putting a colored textbox behind the Group Box and set GB to transparent and changing the control order so text box is prior to GroupBox and my SLE's and Checkboxes on top.  Looks neat and works.
If you do not have the order correct the color textbox is printed over the top of the controls.

Karl answer is better solution without fiddling.
Sample works a treat.. will add ODGroupBox{} class to my Library.

The old Dispatch() and WM_PAINT trick. 

Phil
----

[toc] | [prev] | [next] | [standalone]


#10501

From"Jamal" <noooospam@example.com>
Date2017-04-26 11:59 -0400
Message-ID<odqg5n$n5n$1@news.albasani.net>
In reply to#10495
Karl,

Nice!! I extended it to make it look better by adding two properties to have 
a different RGB background and foreground color of the GroupBox title.

I noticed I have to frequently re-touch the app for color to take effect; 
this is due to VO's resources not being refreshed.

Jamal

"Karl-Heinz"  wrote in message news:embcifFmq1iU1@mid.individual.net...

Hi Phil,

>
> Remind me there has to be a simple way to set the color for the Groupbox
> total area,
>

That makes only sense when you want to fill  the groupbox with a different
owner window color, right ?  But there´s IMHO no simple way to do that.
Here´s a link to a completely self drawn GroupBox.

www.rauscher-software.de/downloads/ODGroupBox.aef

Just play with the Groupbox and Window Background color settings and you´ll
see if it fits your needs. You´ll also see a slightly difference when you
active/deactivate the manifest.

regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#10503

From"Karl-Heinz" <invalid@invalid.invalid>
Date2017-04-26 18:45 +0200
Message-ID<emc16nFqu9mU2@mid.individual.net>
In reply to#10501
Hi Jamal,

> Nice!! I extended it to make it look better by adding two properties to
> have a different RGB background and foreground Color of the GroupBox
> title.

if you like it more colorful, a background color for the titletext only
makes sence ;-)

What i don´t understand: What is your second property  "foreground Color"
good for ? Currently self:Textcolor is already used to draw the titletext.

regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#10504

From"Jamal" <noooospam@example.com>
Date2017-04-26 14:34 -0400
Message-ID<odqp77$29f$1@news.albasani.net>
In reply to#10503
Hi Karl,

The Foreground is for the GroupBox caption only which I set the owner window 
PostInit( ) method:

self:oDCMyGroupBox:dwTitleBackground := RGB(0,0,0)
self:oDCMyGroupBox:dwTitleForeground := RGB(255, 255, 255)


Class modification:

CLASS ODGroupBox INHERIT GroupBox  // OA_CHANGE

    EXPORT dwTitleForeground as DWORD  // RGB value for example: RGB(255, 0, 
255)
    EXPORT dwTitleBackground as DWORD // RGB value


// Dispatch method mod:

//  -------  Draw the caption text if any

     IF SLen ( SELF:Caption ) > 0

           // get and set BKcolor from brush

              GetObject (hBrush, _SIZEOF(_winLOGBRUSH), @strucLogBrush)

            // dwOldBkColor := SetBkColor (hDC , strucLogBrush.lbColor     )

            //  ----------

            dwOldBkColor := SetBkColor (hDC , self:dwTitleBackground) // for 
example RGB(0, 0, 128))


            hOldFont := SelectObject ( hDC , ;
                        PTR ( _CAST , SendMessage ( SELF:handle() , 
WM_GETFONT , 0 , 0L ) )  )

             // dwOldTextColor    := SetTextColor ( hDC , dwTextColor )

             dwOldTextColor    := SetTextColor( hDC , 
self:dwTitleForeground) // for example RGB(255, 0, 255))


           cText := " " + SELF:Caption + " "

                TextOut(hDC, 5 , 0, String2Psz ( cText ) , INT (  SLen ( 
cText )  ) )

            SelectObject ( hDC , hOldFont )
            SetTextColor ( hDC , dwOldTextColor )
            SetBkColor (hDC , dwOldBkColor )

       ENDIF


Jamal

"Karl-Heinz"  wrote in message news:emc16nFqu9mU2@mid.individual.net...

Hi Jamal,

> Nice!! I extended it to make it look better by adding two properties to
> have a different RGB background and foreground Color of the GroupBox
> title.

if you like it more colorful, a background color for the titletext only
makes sence ;-)

What i don´t understand: What is your second property  "foreground Color"
good for ? Currently self:Textcolor is already used to draw the titletext.

regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#10516

From"Karl-Heinz" <invalid@invalid.invalid>
Date2017-04-28 08:44 +0200
Message-ID<emg6t8Fl0lqU2@mid.individual.net>
In reply to#10504
Hi Jamal,

There are some more properties possible ;-)
Here´s a "what if" screenshot:

www.rauscher-software.de/downloads/ODGroupBox.jpg

i simply changed the size and color of the Pen and the last two Roundrect()
params from 0 to 8.

hPen := Pen( PS_SOLID , 3 ,Color { COLORRED }:colorref  )
RoundRect( hDC , struRect.Left , struRect.top , struRect.right ,
struRect.bottom , 8 , 8 )

Of course when doing such things a requirement is to think about the
painting differences when themes are enabled respectively disabled.

regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#10519

From"Jamal" <noooospam@example.com>
Date2017-04-28 13:01 -0400
Message-ID<odvsh5$vno$1@news.albasani.net>
In reply to#10516
Hi Karl,

That's cool!

Have you tried multiple inherited group boxes on the same Data Window? I am 
getting colors all mixed up on the page when I run the app.
If I only have one inherited groupbox, it is ok. I made sure no groupbox are 
transparent.
It seems a window paint issue.

Jamal

"Karl-Heinz"  wrote in message news:emg6t8Fl0lqU2@mid.individual.net...

Hi Jamal,

There are some more properties possible ;-)
Here´s a "what if" screenshot:

www.rauscher-software.de/downloads/ODGroupBox.jpg

i simply changed the size and color of the Pen and the last two Roundrect()
params from 0 to 8.

hPen := Pen( PS_SOLID , 3 ,Color { COLORRED }:colorref  )
RoundRect( hDC , struRect.Left , struRect.top , struRect.right ,
struRect.bottom , 8 , 8 )

Of course when doing such things a requirement is to think about the
painting differences when themes are enabled respectively disabled.

regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#10522

From"Karl-Heinz" <invalid@invalid.invalid>
Date2017-04-29 09:10 +0200
Message-ID<emisorF6dqjU1@mid.individual.net>
In reply to#10519
Hi Jamal,

> Have you tried multiple inherited group boxes on the same Data Window? I
> am getting colors all mixed up on the page when I run the app.

Can you show us a hardcopy how your screen looks like ?

a known issue is that at least the 2.8 SP3 WED gets confused when too many 
Background color and Font changes are done. The result is that approximately 
50% of the created aBrushes[x] and aFont[x] assignments in the Init() are 
wrong. Workaround: Delete all current Background colors/Fonts assignments in 
the WED and save the window. Open it again and reassign the Background 
colors and Fonts in one step.

Here´s a Win 8.1 hardcopy with a Dta- und a DtaDlg-Window. There are no
color differences on Win7, Win8 or Win10.

www.rauscher-software.de/downloads/ODGroupBox2.jpg

regards
Karl-Heinz 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web