FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Window/Dialog Title bar color
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Window/Dialog Title bar color
Posted: Tue Oct 07, 2008 01: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)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Window/Dialog Title bar color
Posted: Tue Oct 07, 2008 02:46 PM

You can't, as far as I know.

EMG

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Window/Dialog Title bar color
Posted: Tue Oct 07, 2008 04: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Window/Dialog Title bar color
Posted: Tue Oct 07, 2008 05: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.







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

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Window/Dialog Title bar color
Posted: Tue Oct 07, 2008 05: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

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Dialog-Titles
Posted: 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 ?



A sample :

// 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 :-)
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.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Sample
Posted: 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



Regards
Uwe :-)
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.
Posts: 189
Joined: Sun Jul 08, 2007 01:46 AM
Window/Dialog Title bar color
Posted: 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)

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Download
Posted: 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.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Source-Files
Posted: Thu Oct 09, 2008 09:55 AM
Hello,

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

Download :

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



Regards
Uwe :-)
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.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Window/Dialog Title bar color
Posted: 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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Changing Title
Posted: Thu Oct 09, 2008 01: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.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Window/Dialog Title bar color
Posted: Thu Oct 09, 2008 02: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Changing Title
Posted: Thu Oct 09, 2008 03: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.



// 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 :-)
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.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Changing Title
Posted: Thu Oct 09, 2008 03: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