Page 1 of 3

New FWH 19.03

Posted: Mon Apr 08, 2019 11:21 am
by Antonio Linares

Re: New FWH 19.03

Posted: Mon Apr 08, 2019 5:35 pm
by Horizon
Hi,

compiling with 19.03 this errors occurs without changing any line in mak file.

Code: Select all

   IcraW.lib kitaplığı ve IcraW.exp nesnesi oluşturuluyor
ICRA_LB2.obj : error LNK2001: Çözümlenmemiş dış sembol _HB_FUN_TACTIVEX
Yardimci.obj : error LNK2001: Çözümlenmemiş dış sembol _HB_FUN_TACTIVEX
FiveH32.lib(MEMOEDIT.obj) : error LNK2001: Çözümlenmemiş dış sembol _HB_FUN_TACTIVEX
FiveH32.lib(SCINTILA.obj) : error LNK2001: Çözümlenmemiş dış sembol _HB_FUN_TACTIVEX
IcraW.exe : fatal error LNK1120: 1 çözümlenmemiş dışlar

Re: New FWH 19.03

Posted: Mon Apr 08, 2019 8:34 pm
by Antonio Linares
Please download it again, thanks

Re: New FWH 19.03

Posted: Mon Apr 08, 2019 9:26 pm
by Horizon
Antonio Linares wrote:Please download it again, thanks
Thanks Antonio,

It seems its ok now.

Re: New FWH 19.03

Posted: Tue Apr 09, 2019 12:29 am
by TimStone
I posted this and it disappeared. I will try again.

On the previous version ( and those before that one ), if you use the Printer class, and your SAY statement includes a color, the program then defaults to that color for all future printing until that is changed.

I print most of my document(s) in the default of Black. However, sometimes I want a word, several words, or a section printed in a different color. It seems most efficient to just use a non-default color only when printing the desired text, and otherwise revert to the default.

This can be accomplished with a simple change to the printer.prg code, and then I won't have to modify that class every time you have an update. Here is what I suggested:
line 614: Add: , nOldColor := GetTextColor( )
line 659: Add: SetTextColor( ::hDCOut, nOldColor )

I was surprised this was not considered on this release since the suggestion was provided several weeks ago, and from my perspective, shows a bug in the current implementation.

Thanks.

Re: New FWH 19.03

Posted: Tue Apr 09, 2019 4:54 am
by Antonio Linares
Tim,

Those lines numbers do not match to current ones.

Please check if this is what you mean:

Code: Select all

METHOD Say( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad ) ;
   CLASS TPrinter

   local nTemp, nOldColor := GetTextColor()

   if ::hDC = 0
      return nil
   endif

   DEFAULT oFont := ::oFont ,;
       nBkMode := 1     ,;
       nPad    := ::nPad

   if oFont != nil
      oFont:Activate( ::hDCOut )
   endif

   SetbkMode( ::hDCOut, nBkMode )         // 1,2 transparent or Opaque

   if nClrText != nil
      SetTextColor( ::hDCOut, nClrText )
   endif

   if Empty( nWidth )
      do case
         case nPad == PAD_RIGHT
              nCol := Max( 0, nCol - ::GetTextWidth( cText, oFont ) )
         case nPad == PAD_CENTER
              nCol := Max( 0, nCol - ( ::GetTextWidth( cText, oFont ) / 2 ) )
      endcase
      SetTextAlign( ::hDCOut, TA_LEFT )
      TextOut(  ::hDCOut, nRow, nCol, cText )
   else
      do case
         case nPad == PAD_RIGHT
              nTemp := nCol + nWidth
              SetTextAlign( ::hDCOut, TA_RIGHT )
         case nPad == PAD_CENTER
              nTemp := nCol + ( nWidth / 2 )
              SetTextAlign( ::hDCOut, TA_CENTER )
         otherwise
              nTemp := nCol
              SetTextAlign( ::hDCOut, TA_LEFT )
      endcase
      ExtTextOut( ::hDCOut, nRow, nTemp,;
                  { nRow, nCol, nRow + oFont:nHeight * 1.5, nCol + nWidth },;
                  cText, ETO_CLIPPED )
   endif

   if oFont != nil
      oFont:DeActivate( ::hDCOut )
   endif

   SetTextColor( ::hDCOut, nOldColor )

return nil
 

Re: New FWH 19.03

Posted: Tue Apr 09, 2019 6:19 am
by hua

Re: New FWH 19.03

Posted: Tue Apr 09, 2019 6:22 pm
by TimStone
Antonio,

Yes, that is exactly what I meant.

Hua,

You will notice the last comment on the thread you referenced. It was TOTALLY WRONG but I decided not to argue about it. In fact, my code for nearly 100 reports/invoices/etc is all object based. And, most importantly, the problem DOES EXIST WITH SAYTEXT( ) which is what I am using after Nages suggested it. But why argue? Based on his assumption of usage, he was not interested in changing this.

Code: Select all

// Prints FAIL as white on red 
      oPrn:SayText( nRow, 2 * nCsp, "FAIL",6*nCsp,nRsp, oFbold, , CLR_WHITE, oBrushRed )
// Prints text in White on Red
     oPrn:SayText( nRow, 10 * nCsp, MemoLine( oPrintInspect:svcdes, 60, lx,, .T. ),,, oFnorm )
// Required to return text to default of black on white
     oPrn:SayText( nRow, 10 * nCsp, MemoLine( oPrintInspect:svcdes, 60, lx,, .T. ),,, oFnorm, , CLR_BLACK, oBrushWhite )
 
In this case, I only want the line to change color if it has a "FAIL" indicated. If I do that, all future lines would be white on red unless I change the color back.

Re: New FWH 19.03

Posted: Wed Apr 10, 2019 3:14 am
by nageswaragunupudi
Mr Tim

I request you to kindly feel free to point out my mistakes. I will never look at such comments as arguments, but only as a help to rectify my mistakes and serve you and all other users better.

We are looking into all the points raised by you and will soon come up with suitable solutions.

Re: New FWH 19.03

Posted: Wed Apr 10, 2019 3:52 pm
by TimStone
I would like to assure you that when you, or Antonio, ( and others ) make a recommendation, I ALWAYS try them first. You will see in almost all cases, I respond that your solution worked. This is the one exception.

Also, I always explore the source code first, and try to understand an implementation, before asking a question. Sometimes I do ask a "quick question" because so many solutions are present that are not (yet) documented and I want to take advantage of them.

In this case, I immediately moved to SAYTEXT( ) and the brush solution you suggested. Yes, that worked, but it had the problem of resetting to the default color as I explained with the three lines of sample code.

I don't like to modify files included in the .lib because when you update them with enhancements, I have to go back and re-add my modifications to the latest version, and sometimes I forget, losing out on valuable new capabilities you have added.

Thanks for all you do.

Re: New FWH 19.03

Posted: Wed Apr 10, 2019 5:10 pm
by nageswaragunupudi
TimStone wrote:Antonio,

Yes, that is exactly what I meant.

Hua,

You will notice the last comment on the thread you referenced. It was TOTALLY WRONG but I decided not to argue about it. In fact, my code for nearly 100 reports/invoices/etc is all object based. And, most importantly, the problem DOES EXIST WITH SAYTEXT( ) which is what I am using after Nages suggested it. But why argue? Based on his assumption of usage, he was not interested in changing this.

Code: Select all

// Prints FAIL as white on red 
      oPrn:SayText( nRow, 2 * nCsp, "FAIL",6*nCsp,nRsp, oFbold, , CLR_WHITE, oBrushRed )
// Prints text in White on Red
     oPrn:SayText( nRow, 10 * nCsp, MemoLine( oPrintInspect:svcdes, 60, lx,, .T. ),,, oFnorm )
// Required to return text to default of black on white
     oPrn:SayText( nRow, 10 * nCsp, MemoLine( oPrintInspect:svcdes, 60, lx,, .T. ),,, oFnorm, , CLR_BLACK, oBrushWhite )
 
In this case, I only want the line to change color if it has a "FAIL" indicated. If I do that, all future lines would be white on red unless I change the color back.
We are testing.
This is a sample using your code. We have only changed the text. We also used an old version of FWH. Current version also would behave the same way.

Sample:

Code: Select all

#include "fivewin.ch"

function Main()

   local oPrn
   local oBrushRed, oBrushGrn
   local oFont
   local nRow  := 300
   local nCsp  := 200
   local nRsp  := 200

   DEFINE BRUSH oBrushRed COLOR CLR_RED
   DEFINE BRUSH oBrushGrn COLOR CLR_HGREEN

   PRINT oPrn PREVIEW

   DEFINE FONT oFont NAME "TAHOMA"  SIZE 0,-20 OF oPrn

   PAGE

      oPrn:SayText(  nRow,  2 * nCsp, FWVERSION,          6 * nCsp, nRsp, oFont, nil, CLR_YELLOW, oBrushRed )
      oPrn:SayText(  nRow, 10 * nCsp, "Default: nil,nil", 6 * nCsp, nRsp, oFont )

      nRow  += nRsp + 100

      oPrn:SayText(  nRow,  2 * nCsp, FWVERSION,          6 * nCsp, nRsp, oFont, nil, CLR_BLUE,   oBrushGrn )
      oPrn:SayText(  nRow, 10 * nCsp, "Default: nil,nil", 6 * nCsp, nRsp, oFont )

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont
   RELEASE BRUSH oBrushRed, oBrushGrn

return nil
 
Image

With this sample, we are not able to see the problem that you mentioned. Are we missing something? Or do you suggest any change in the above code so that we can see the problem you mentioned?

We are still conducting our tests.

Re: New FWH 19.03

Posted: Wed Apr 10, 2019 5:25 pm
by nageswaragunupudi
Another test:

Code: Select all

#include "fivewin.ch"

function Main()

   local oPrn
   local oBrushRed, oBrushGrn
   local oFont

   DEFINE BRUSH oBrushRed COLOR CLR_RED
   DEFINE BRUSH oBrushGrn COLOR CLR_HGREEN

   PRINT oPrn PREVIEW

   DEFINE FONT oFont NAME "TAHOMA"  SIZE 0,-20 OF oPrn

   PAGE

//    Using method directly
//    oPrn:SayText(  row, col, <text>            ,width,Heit, oFont,Align, ClrText,BckClr/Brush, UNITS   )
//    ----------------------------------------------------------------------------------------------------

      oPrn:SayText(  300, 400, "Yellow, RedBrush", 2000, 200, oFont, nil, CLR_YELLOW, oBrushRed, "PIXEL" )
      oPrn:SayText(  620, 400, "Default: nil,nil", 2000, 200, oFont, nil, nil,        nil,       "PIXEL" )
      oPrn:SayText(  940, 400, "Red,  GreenBrush", 2000, 200, oFont, nil, CLR_HRED,   oBrushGrn, "PIXEL" )
      oPrn:SayText( 1260, 400, "Default: nil,nil", 2000, 200, oFont, nil, nil,        nil,       "PIXEL" )
      oPrn:SayText( 1580, 400, "Yellow, RedBrush", 2000, 200, oFont, nil, CLR_YELLOW, oBrushRed, "PIXEL" )
      oPrn:SayText( 1900, 400, "Default: nil,nil", 2000, 200, oFont, nil, nil,        nil,       "PIXEL" )
      oPrn:SayText( 2220, 400, "Default: nil,nil", 2000, 200, oFont, nil, nil,        nil,       "PIXEL" )
      oPrn:SayText( 2540, 400, FWVERSION,          2000, 200, oFont, nil, CLR_HRED,   oBrushGrn, "PIXEL" )

/*
      // COMMAND SYNTAX ( Clarity of code, ease of coding, avoids possible mistakes in using method directly )

      @  300,400 PRINT TO oPrn TEXT "Yellow, RedBrush"  SIZE 2000,200 PIXEL FONT oFont COLOR CLR_YELLOW,oBrushRed
      @  620,400 PRINT TO oPrn TEXT "Default: nil,nil"  SIZE 2000,200 PIXEL FONT oFont
      @  940,400 PRINT TO oPrn TEXT "Red,  GreenBrush"  SIZE 2000,200 PIXEL FONT oFont COLOR CLR_HRED,  oBrushGrn
      @ 1260,400 PRINT TO oPrn TEXT "Default: nil,nil"  SIZE 2000,200 PIXEL FONT oFont
      @ 1580,400 PRINT TO oPrn TEXT "Yellow, RedBrush"  SIZE 2000,200 PIXEL FONT oFont COLOR CLR_YELLOW,oBrushRed
      @ 1900,400 PRINT TO oPrn TEXT "Default: nil,nil"  SIZE 2000,200 PIXEL FONT oFont
      @ 2220,400 PRINT TO oPrn TEXT "Default: nil,nil"  SIZE 2000,200 PIXEL FONT oFont
      @ 2540,400 PRINT TO oPrn TEXT FWVERSION           SIZE 2000,200 PIXEL FONT oFont COLOR CLR_HRED,  oBrushGrn
*/

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont
   RELEASE BRUSH oBrushRed, oBrushGrn

return nil
 
Image

Can not yet see the problem.

Still we are testing.

Re: New FWH 19.03

Posted: Wed Apr 10, 2019 8:02 pm
by byte-one
I can say, that after i use a certain color for text, this color are stay in further oPrn:say()s! If i will back to black i must this explicit define in the next oPrn:say()!

Re: New FWH 19.03

Posted: Wed Apr 10, 2019 9:33 pm
by TimStone
I may have found the problem.

My invoice print routine is 1450 lines long. In the past I have always use oPrn:Say( ) to print the text. To add the color lines I changed to SayText( ). However, the non- colored lines I left at @Say format.

What I have found is if you use @SayText( ) it does change the color default for @Say( ). The @SayText performs as you show.

I see Gunther was noting the same behavior that I observed.

I can fix the problem in my code by using @SayText( ) throughout when mixing in color.

Tim.

Re: New FWH 19.03

Posted: Thu Apr 11, 2019 1:25 am
by nageswaragunupudi
This is off-topic.

For printing long multiline texts, memos, it is no more necessary to split the text into separate lines with memoline() and print each line separately.

With a single call to the method SayText() the entire memo can be printed.

This is a sample:

Code: Select all

#include "fivewin.ch"

function Main()

   local oPrn
   local oBrushRed, oBrushGrn
   local oFont, oFont2, oFont3, oFont4
   local cText1, cText2, cText3
   local nRow, nRow1, nRow2

   cText1   := "On the previous version ( and those before that one ), if " + ;
      "you use the Printer class, and your SAY statement includes a color, " + ;
      "the program then defaults to that color for all future printing " + ;
      "until that is changed." + CRLF + "." + CRLF + ;
      "I print most of my document(s) in the default of Black. However, " + ;
      "sometimes I want a word, several words, or a section printed in a " + ;
      "different color. It seems most efficient to just use a non-default " + ;
      "color only when printing the desired text, and otherwise revert to " + ;
      "the default."

   cText2   := "This can be accomplished with a simple change to the " + ;
      "printer.prg code, and then I won't have to modify that class every " + ;
      "time you have an update. Here is what I suggested:" + CRLF + ;
      "line 614: Add: , nOldColor := GetTextColor( )" + CRLF + ;
      "line 659: Add: SetTextColor( ::hDCOut, nOldColor )" + CRLF + ;
      "I was surprised this was not considered on this release since the " + ;
      "suggestion was provided several weeks ago, and from my perspective, " + ;
      "shows a bug in the current implementation."

   cText3   := "You will notice the last comment on the thread you referenced. " + ;
      "It was TOTALLY WRONG but I decided not to argue about it. In fact, my " + ;
      "code for nearly 100 reports/ invoices, etc is all object based. And, most " + ;
      "importantly, the problem DOES EXIST WITH SAYTEXT( ) which is what I am " + ;
      "using after Nages suggested it. But why argue? Based on his assumption " + ;
      "of usage, he was not interested in changing this."

   DEFINE BRUSH oBrushRed COLOR CLR_RED
   DEFINE BRUSH oBrushGrn COLOR CLR_HGREEN

   PRINT oPrn PREVIEW

   DEFINE FONT oFont  NAME "TAHOMA"   SIZE 0,-14 OF oPrn
   DEFINE FONT oFont2 NAME "VERDANA"  SIZE 0,-14 OF oPrn
   DEFINE FONT oFont3 NAME "Segoe UI" SIZE 0,-16 OF oPrn
   DEFINE FONT oFont4 NAME "ARIAL NARROW" SIZE 0,-10 OF oPrn

   PAGE

   nRow  := 1.5

   @ nRow, 1.0 PRINT TO oPrn TEXT cText1 SIZE 2.8, nil FONT oFont  ;
               COLOR { CLR_BLACK, CLR_BLACK, CLR_GREEN } ;
               INCHES LASTROW nRow1

   @ nRow, 4.2 PRINT TO oPrn TEXT cText2 SIZE 2.8, nil FONT { oFont2, oFont4, oFont4, oFont2 } ;
               COLOR { CLR_BLACK, CLR_HRED, CLR_HRED, CLR_BLUE } ;
               INCHES LASTROW nRow2

   nRow  := Max( nRow1, nRow2 ) + 0.5

   @ nRow, 1.0 PRINT TO oPrn TEXT cText3 SIZE 6.0, nil FONT oFont3  INCHES

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont, oFont2, oFont3
   RELEASE BRUSH oBrushRed, oBrushGrn

return nil
 
Image