Window/Dialog Title bar color

User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Window/Dialog Title bar color

Post by Jeff Barnes »

Hi Everybody,

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

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Post by driessen »

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. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

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 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Dialog-Titles

Post by ukoenig »

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


// 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: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Sample

Post by ukoenig »

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.
Ruben D. Fernandez
Posts: 189
Joined: Sun Jul 08, 2007 1:46 am
Location: Uruguay

Post by Ruben D. Fernandez »

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)
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Download

Post by ukoenig »

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: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Source-Files

Post by ukoenig »

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
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Changing Title

Post by ukoenig »

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
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Changing Title

Post by ukoenig »

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


// 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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Changing Title

Post by Enrico Maria Giordano »

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