FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SAY default background color
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
SAY default background color
Posted: Sun Dec 30, 2007 01:48 PM
Antonio,

I think that the background color of SAYs are not defaulting properly. This is from TSay:Redefine():

   DEFAULT oWnd      := GetWndDefault(),;
           nClrText  := oWnd:nClrText,;
           nClrBack  := GetSysColor( COLOR_BTNFACE ),;


nClrText is fine, but nClrBack is defaulting to the default dialog color. This works as long as you are putting the SAY on dialog with the default color, but not if the dialog has a different color than the default. I suggest that it should be:

nClrBack := oWnd:nClrBack

The TSay:New() method is different still.

          nClrBack := iif(Upper( oWnd:Classname() ) != "TWINDOW",;
                           GetSysColor( COLOR_BTNFACE ),;
                           oWnd:nClrPane),;


This defaults to the background color of it's parent but only if the parent is a TWindow. If not putting the SAY on a Window it defaults to the default dialog color which has the same problem as above. So I suggest always defaulting the background color of the SAY to it's parent's background color.

nClrBack := oWnd:nClrBack

However, since these days we are doing more with fancy graphics like putting bitmaps on windows and dialogs, etc., so it seems it would be better if SAYs always defaulted to transparent so they would always show the background of the parent even if it was a bitmap. This behavior would make the default color moot. Perhaps there is some reason this can't or shouldn't be done?

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
SAY default background color
Posted: Sun Dec 30, 2007 07:26 PM

James,

Have you tried those proposed changes and see if they work fine ?

The issue about transparency is that Windows does not provide such feature, and we need to do it programmatically.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
SAY default background color
Posted: Mon Dec 31, 2007 11:27 PM

Antonio,

>Have you tried those proposed changes and see if they work fine ?

I'll do some testing and report back.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
SAY default background color
Posted: Thu Jan 03, 2008 07:56 PM
Antonio,

I tested the suggested revised default colors for both TWindow and TSay and I didn't see any problems. These changes would make Says appear to be transparent on any colored object (window, dialog, messagebar, etc) because they will always inherit the background color of the SAYs parent object.

My test code is below.

They would still not be truely transparent since they would not have a transparent background when drawn over a bitmap. After the next version of FWH comes out, I will work on testing SAYs that are truely transparent by default.

Regards,
James

/*
Purpose: Test default TWindow and TSay colors
*/

#include "Fivewin.ch"

function main()
   local oWnd, oBar, oBtn

   define window oWnd title "Test Window"
   oWnd:setColor( CLR_BLACK, CLR_YELLOW )

   define buttonbar oBar of oWnd 3d
   define button of oBar action doit()
   define button of oBar action msgInfo("Sample message")

   @ 2,2 say "Sample Text" of oWnd

   @ 3,2 button oBtn of oWnd size 50,22

   set message to "Message goes here" of oWnd DATE

   activate window oWnd

return nil

function doit()
   local oDlg,cName:="test name   "
   define dialog oDlg title "Sample Dialog"
   @ 2,2 say "Sample Say" of oDlg
   @ 4,2 get cName of oDlg
   activate dialog oDlg centered
return nil

// end
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion