SAY default background color

SAY default background color

Postby James Bott » Sun Dec 30, 2007 1:48 pm

Antonio,

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

Code: Select all  Expand view
   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.

Code: Select all  Expand view
          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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Sun Dec 30, 2007 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby James Bott » Thu Jan 03, 2008 7: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

Code: Select all  Expand view
/*
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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: shrifw and 64 guests