Window/Dialog Title bar color

Window/Dialog Title bar color

Postby Jeff Barnes » Tue Oct 07, 2008 1:51 pm

Hi Everybody,

How can I change just the window title bar to a different color?
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Window/Dialog Title bar color

Postby Enrico Maria Giordano » Tue Oct 07, 2008 2:46 pm

You can't, as far as I know.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby driessen » Tue Oct 07, 2008 4:47 pm

Yes you can change the color of the Window/Dialog Title bar.

But you can't do it in FWH.

You can change it in the properties of your screen by right clicking on the desktop and chosing "properties".

Good luck.[/img]
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby Jeff Barnes » Tue Oct 07, 2008 5:37 pm

Just to be sure we are talking about the same thing....



I want to give the user a visual notification when they have changed a certain setting.


Image




http://www.can-soft.net/dl/Title.jpg
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Enrico Maria Giordano » Tue Oct 07, 2008 5:50 pm

Yes, you can't change color title programmatically, as far as I know. Try using a label or any other control as color indicator.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Dialog-Titles

Postby ukoenig » Tue Oct 07, 2008 11:57 pm

Hello,

With the VTools you can create any Dialog-Title-Styles and Size :
Gradients, Brushes, Mono-Colors, Fonts, with or without frames and more.

For Windows, it seems not possible, because there is allways a title on top.
Maybe somebody knows, how to get a empty window ?

Image

A sample :

Code: Select all  Expand view

// Create a Bitmap on top of the Dialog.  Use a little Bitmap ( Blanc )
// as container. The Dialog should be just a frame.
// The Bitmap ( Blanc 20 x 20 ) will be resized and filled with the
// defined Brush / Gradient / Color :

REDEFINE BITMAP oBmp1  ID 100 ADJUST RESOURCE "Blanc"  OF oDlg
oBMP1:bPainted := { |hDC|OnPaint( hDC,oBMP1, 128,15779475, 77215, ;
"Horizontal Dialog Title",  ;
oBfont1, 0 ,"TEST.BMP" ,3 ) }

//--------------- Paint the Dialog-Title --------------------------------//

FUNCTION ONPAINT(hDC,oBmp,nVColor, nBColor,nColor,cText, ;
                                    oBFont1, nLEFT, cBRUSH, nPEN )
LOCAL hOldFont, oNewbrush, hBitmap, aRect, oBmp1, nTOP

hOldFont := SelectObject( hDC, oBFont1:hFont )
nTOP := 5 
nTXTLG :=  GettextWidth( hDC, cText )
nBMPLONG  := oBmp:Super:nWidth()
nBMPHIGHT := oBmp:Super:nHeight()
nFONTHIGHT := oBfont1:nInpHeight * -1
nLEFT := (nBMPLONG - nTXTLG) / 2 
nNEWHIGHT := nFONTHIGHT
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2
aRect := GETCLIENTRECT( oBmp:hWnd )
nGRADIENT := Gradient( hDC, aRect, nVColor, nBColor, .T. )  // .T.  Horizontal
oBmp:oBrush := TBrush():New( , nGRADIENT )
SetTextColor( hDC,nColor)
SetBkMode( oBmp:hDC, 0 )
FillRect( hDC, aRect, oBmp:oBrush:hBrush )
TextOut( hDC, nTOP, nLEFT, cText )
SelectObject( hDC, hOldFont )
IF nPEN > 0
   DRAWBOX( aRect, hDC, nColor, nBMPLONG, nBMPHIGHT, nPEN )
ENDIF

RETURN NIL

// --------  DRAW BOX --------------------------------

STATIC FUNCTION DRAWBOX( aRect, hDC, nColor, nBMPLONG, nBMPHIGHT, nPEN )
LOCAL hPen := CREATEPEN( PS_SOLID, nPEN, nColor )
LOCAL hOldPen := SELECTOBJECT( hDC, hPen )

MOVETO( hDC, 0, 0 )
LINETO( hDC, nBMPLONG, 0 )
LINETO( hDC, nBMPLONG, nBMPHIGHT )
LINETO( hDC, 0, nBMPHIGHT )
LINETO( hDC, 0, 0 )
SELECTOBJECT( hDC, hOldPen )
DELETEOBJECT( hPen )

RETURN NIL



Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Sample

Postby ukoenig » Wed Oct 08, 2008 11:38 am

Hello,

Here is a Sample-Screenshot :
The Dialog-Gradient works also with older-versions of FWH.
The Button < New text > changes the Dialog-Title-Text.
If somebody needs the source, i can put it in the forum.

Sample Download :
http://www.pflegeplus.com/fw_downloads/DlgTitle.zip

Image

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Ruben D. Fernandez » Wed Oct 08, 2008 10:56 pm

Uwe:

This is great, could you please, put the code here in some place to
download?

Best regards

Ruben Fernandez.
(Sorry for my bad English)
Ruben D. Fernandez
 
Posts: 189
Joined: Sun Jul 08, 2007 1:46 am
Location: Uruguay

Download

Postby ukoenig » Wed Oct 08, 2008 11:09 pm

Hello Ruben,

A complete Source ( exe, resource, RMK ... )
with many new parameters, i put tomorrow in the forum.

nColor1 :=128 // 1. Gradient-Color
nColor2 := 15779475 // 2. Gradient-Color
nColort := 16777215 // Text-Color
lGrad := .T. // Gradient or MONO-Color
cText := "Horizontal Dialog Title" // Text
nTop := 10 // Top Text-Pos. 0 = Center Vertical
nLeft := 0 // Left Text-Pos. 0 = Center Horizontal
nPen := 0 // Pen-Weight for Frame 0 = no Frame
nPColor := 16777215 // Frame-Color
cBrush := "" // Title BMP-Brush

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Source-Files

Postby ukoenig » Thu Oct 09, 2008 9:55 am

Hello,

Here is the complete Source and EXE for the Dialog-Titles

Download :

http://www.pflegeplus.com/fw_downloads/DialogTitle.zip

Image

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby James Bott » Thu Oct 09, 2008 12:43 pm

Jeff,

>I want to give the user a visual notification when they have changed a certain setting.

May I suggest highlighting the setting that was changed instead. This would give more specific information--coloring the titlebar would only show that something was changed but not what.

Also, even if you could change the titlebar color, I would be worried that different themes might override this.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Changing Title

Postby ukoenig » Thu Oct 09, 2008 1:28 pm

Hello James,

It is not only the color. you can change the text, position, drawing
frames around the title and so on at runtime in combination to any action.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby James Bott » Thu Oct 09, 2008 2:43 pm

Uwe,

>It is not only the color. you can change the text, position, drawing
frames around the title and so on at runtime in combination to any action.

OK, but for Jeff's application, as I stated I think it would be better to highlight the particular setting that has been changed.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Changing Title

Postby ukoenig » Thu Oct 09, 2008 3:09 pm

Hello James,
you mean, changing the get-color after changing the value ?

Another sample with dialog-titles on a GET :
In Jeff's sample, he could show the Patient-name in the Dialog-title.

Image

Code: Select all  Expand view

// Changing Title with GET
// ---------------------------------
REDEFINE GET oText1 VAR cText1  ID 120
oText1:bChange := {|| (nColor1 :=15779475, ;
    nColor2 := 128, nColort := 0, ;
    cText := "You changed the Get-Field : Customer", ;
    lGrad := .F., nTop := 12, nLeft := 20, ;
    nPen := 0, nPColor := 0, cBrush := "", ;
    oBMP1:Refresh() ) }

// Could also be instead of a Text-Message a Database-Field :
// cText := (1)->PAT_NAME, ;




Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Changing Title

Postby Enrico Maria Giordano » Thu Oct 09, 2008 3:30 pm

Only to note that Uwe's titlebar is not the real titlebar and it will not follow current Windows theme. Or am I wrong?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests