How to set TSAY with Default TRANSPARENT

How to set TSAY with Default TRANSPARENT

Postby dutch » 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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to set TSAY with Default TRANSPARENT

Postby Rick Lipkin » 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: Select all  Expand view

Func LightGreyGrad()

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

Return(nil)
 
User avatar
Rick Lipkin
 
Posts: 2634
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: How to set TSAY with Default TRANSPARENT

Postby dutch » Fri Jul 03, 2015 5: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: Select all  Expand view

Func LightGreyGrad()

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

Return(nil)
 
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to set TSAY with Default TRANSPARENT

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

Re: How to set TSAY with Default TRANSPARENT

Postby Antonio Linares » Sat Jul 04, 2015 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to set TSAY with Default TRANSPARENT

Postby nageswaragunupudi » Sun Jul 05, 2015 2: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: Select all  Expand view
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: Select all  Expand view
#xtranslate TSay() => TSay2()
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to set TSAY with Default TRANSPARENT

Postby dutch » Sun Jul 05, 2015 4:07 am

Dear Rao,

I did as your comment but the program freeze.
nageswaragunupudi wrote:Keep this derived class in the main module
Code: Select all  Expand view
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: Select all  Expand view
#xtranslate TSay() => TSay2()
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to set TSAY with Default TRANSPARENT

Postby nageswaragunupudi » Sun Jul 05, 2015 4: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: Select all  Expand view

// 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
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to set TSAY with Default TRANSPARENT

Postby dutch » Sun Jul 05, 2015 10:10 am

Dear Mr.Rao,

Thanks so much for your kind support.
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to set TSAY with Default TRANSPARENT

Postby James Bott » Mon Jul 06, 2015 2: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
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: Google [Bot] and 42 guests