FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to set TSAY with Default TRANSPARENT
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
How to set TSAY with Default TRANSPARENT
Posted: Thu Jul 02, 2015 10:04 PM

Dear All,

As subject, I define the colors for DIALOG and SAY Text must be TRANSPARENT. Everytime I upgrade FWH, I have to change DATA ::lTransparent to .T. and build to the LIB.

I don't know how to override this data in SAY Class.

Thanks for any idea or help.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: How to set TSAY with Default TRANSPARENT
Posted: Thu Jul 02, 2015 10:10 PM
Dutch

Have a look at the SetDlgGradient() function.. you can create many different gradient backgrounds and this is a system wide setting which sets the transparent global flag as well.

Just call your User Defined Gradient at the top of your program... and you can call different gradients as often as you like.

Rick Lipkin

Code (fw): Select all Collapse
Func LightGreyGrad()

SetDlgGradient( { { .50, nRGB( 216, 216, 216 ), nRGB( 255, 255, 255 ) } } )

Return(nil)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to set TSAY with Default TRANSPARENT
Posted: Fri Jul 03, 2015 05:20 AM
Dear Rick,

Thank you so much for your idea, it is good choice and work as expectation.
Rick Lipkin wrote:Dutch

Have a look at the SetDlgGradient() function.. you can create many different gradient backgrounds and this is a system wide setting which sets the transparent global flag as well.

Just call your User Defined Gradient at the top of your program... and you can call different gradients as often as you like.

Rick Lipkin

Code (fw): Select all Collapse
Func LightGreyGrad()

SetDlgGradient( { { .50, nRGB( 216, 216, 216 ), nRGB( 255, 255, 255 ) } } )

Return(nil)
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: How to set TSAY with Default TRANSPARENT
Posted: Sat Jul 04, 2015 04:33 PM

As I have said a few times before, I can't see any reason why Fivewin SAYs shouldn't be transparent by default. In fact all the controls. They would all then just let whatever background there is show through. Perhaps there is an issue I am not seeing though.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to set TSAY with Default TRANSPARENT
Posted: Sat Jul 04, 2015 05:01 PM

James,

good point. You are right.

Anyhow I wonder if we could break backwards compatibility in the existing apps
if we default it to true.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to set TSAY with Default TRANSPARENT
Posted: Sun Jul 05, 2015 02:17 AM
1) If the dialog is set to transparent, all controls, including says, are transparent. This is how we have always been coding.
2) Keeping backward compatibility aside, not all controls can be transparent by default. While it is nice to have say, etc transparent by default, gets, browses, graphs and many more should not be transparent by default. That means FWH should selectively make some controls transparent by default and some non-transparent. That in turn means:
(a) Programmer has to remember, or keep referring to documentation, which control is transparent by default and which is not
(b) FWH should add one more clause "NOTRANSPARENT", for those cases where we want a default transparent control to be non-transparent. There are many cases where we need to use a SAY in non-transparent mode too.
Present system is uniform for all controls and there is no confusion to the programmer.
3) Any change now in the default behavior effects backward compatibility.
4) For every control we need to anyway type several clauses and I do not find any reason to get tired to type one more word TRANSPARENT at the end.
5) Another way is to provide a class variable for transparency, which a programmer can set at the beginning.
6) Meanwhile this can be a possible solution to the original posting of this thread:

Keep this derived class in the main module
Code (fw): Select all Collapse
CLASS TSay2 FROM TSay
   DATA lTransparent INIT .t.
ENDCLASS

and then have one common include file that will be included in every program in the project
eg: mycommon.ch
Code (fw): Select all Collapse
#xtranslate TSay() => TSay2()
Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to set TSAY with Default TRANSPARENT
Posted: Sun Jul 05, 2015 04:07 AM
Dear Rao,

I did as your comment but the program freeze.
nageswaragunupudi wrote:
Keep this derived class in the main module
Code (fw): Select all Collapse
CLASS TSay2 FROM TSay
   DATA lTransparent INIT .t.
ENDCLASS

and then have one common include file that will be included in every program in the project
eg: mycommon.ch
Code (fw): Select all Collapse
#xtranslate TSay() => TSay2()
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to set TSAY with Default TRANSPARENT
Posted: Sun Jul 05, 2015 04:54 AM
Mr Dutch

My mistake. Derived class should also have classdata lRegistered. Anyway, please ignore my above suggestion totally.

Instead let us have a revised #xcommand in our personal include file.

myinclude.ch
Code (fw): Select all Collapse
// revised say commands
#xcommand REDEFINE SAY [<oSay>] ;
             [ <label: PROMPT, VAR> <cText> ] ;
             [ <pict: PICT, PICTURE> <cPict> ] ;
             [ ID <nId> ] ;
             [ <dlg: OF,WINDOW,DIALOG > <oWnd> ] ;
             [ <color: COLOR,COLORS > <nClrText> [,<nClrBack> ] ] ;
             [ <update: UPDATE > ] ;
             [ FONT <oFont> ] ;
             [ <trans: TRANSPARENT> ] ;
             [ <adj: ADJUST> ] ;
       => ;
          [ <oSay> := ] TSay():ReDefine( <nId>, <{cText}>, <oWnd>, ;
                        <cPict>, <nClrText>, <nClrBack>, <.update.>, <oFont>, .t., <.adj.> )

#xcommand @ <nRow>, <nCol> SAY [ <oSay> <label: PROMPT,VAR > ] <cText> ;
             [ <pict: PICT, PICTURE> <cPict> ] ;
             [ <dlg: OF,WINDOW,DIALOG > <oWnd> ] ;
             [ FONT <oFont> ]  ;
             [ <lCenter: CENTERED, CENTER > ] ;
             [ <lRight:  RIGHT >    ] ;
             [ <lBorder: BORDER >   ] ;
             [ <lPixel: PIXEL, PIXELS > ] ;
             [ <color: COLOR,COLORS > <nClrText> [,<nClrBack> ] ] ;
             [ SIZE <nWidth>, <nHeight> ] ;
             [ <design: DESIGN >  ] ;
             [ <update: UPDATE >  ] ;
             [ <lShaded: SHADED, SHADOW > ] ;
             [ <lBox:    BOX   >  ] ;
             [ <lRaised: RAISED > ] ;
             [ <adj: ADJUST> ] ;
             [ <lTrans: TRANSPARENT>];
      => ;
          [ <oSay> := ] TSay():New( <nRow>, <nCol>, <{cText}>,;
             [<oWnd>], [<cPict>], <oFont>, <.lCenter.>, <.lRight.>, <.lBorder.>,;
             <.lPixel.>, <nClrText>, <nClrBack>, <nWidth>, <nHeight>,;
             <.design.>, <.update.>, <.lShaded.>, <.lBox.>, <.lRaised.>, <.adj.>,;
             .t., [<(oSay)>] )

Now include myinclude.ch in all programs of the project, as the last include file. In any case this include should be after include "fivewin.ch"
I tested here and this is working for me.
Please test at your end.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to set TSAY with Default TRANSPARENT
Posted: Sun Jul 05, 2015 10:10 AM

Dear Mr.Rao,

Thanks so much for your kind support.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: How to set TSAY with Default TRANSPARENT
Posted: Mon Jul 06, 2015 02:45 PM
Rao,

Thanks for all you input. Obviously there are reason for not doing what I suggested. And this is news to me:

1) If the dialog is set to transparent, all controls, including says, are transparent.


I did not know this and I suspect that lots of others did not know this either. This does solve a lot of problems with transparency.

There are many cases where we need to use a SAY in non-transparent mode too.


Please provide some examples. I don't remember ever needing to do this.

Yes, backward compatibility is always an issue. Perhaps as you have shown, a global setting allowing us to use global transparency or not would solve this.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion