FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in TSay
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TSay
Posted: Sun Dec 24, 2006 10:58 PM
The following sample shows the problem:

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oSay

    LOCAL n := 0

    DEFINE DIALOG oDlg

    @ 1, 1 SAY oSay PROMPT "Counter: " + LTRIM( STR( n ) );
           SIZE 200, 15

    @ 2, 1 BUTTON "Start";
           ACTION COUNTER( oSay, @n )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


STATIC FUNCTION COUNTER( oSay, n )

    LOCAL i

    FOR i = 1 TO 100
        n++
        oSay:Refresh()
        SYSWAIT( 0.01 )
    NEXT

    TONE( 400, 1 )

    RETURN NIL


It should count from 1 to 100 when the button is pressed. Instead the label shows 1 and is not refreshed anymore.

The cause seems to be the statement

::VarPut( ::cCaption )


added in the latest TSay class.

EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TSay
Posted: Sun Dec 24, 2006 11:04 PM

Even during reports generation the counter is not updated anymore.

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TSay
Posted: Mon Dec 25, 2006 12:57 AM

Enrico,

We may remove ::VarPut( ::cCaption ) from Class TSay Method SetText(), but then preview page number is wrongly shown.

We need to find a way to fix the preview page number.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TSay
Posted: Mon Dec 25, 2006 01:01 AM

Ok, the solution seems to replace in source\classes\rpreview.prg all oPage:SetText(...) into oPage:VarPut(...)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TSay
Posted: Mon Dec 25, 2006 01:13 AM
This looks as a right fix for rpreview.prg:
     if ! IsAppThemed()
        oPage:VarPut( TXT_PAGENUM + LTrim( Str( nPage, 4, 0 ) ) + " / " + ;
                                    LTrim( Str( Len( aFiles ) ) ) )
     else                               
        oPage:SetText( TXT_PAGENUM + LTrim( Str( nPage, 4, 0 ) ) + " / " + ;
                                     LTrim( Str( Len( aFiles ) ) ) )
     endif

In all places where oPage:SetText() was called.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TSay
Posted: Mon Dec 25, 2006 09:23 AM

Enrico,

But if a window is moved over the preview, then it will have the same effect as calling :Refresh()

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TSay
Posted: Mon Dec 25, 2006 09:29 AM
Antonio Linares wrote:Enrico,

But if a window is moved over the preview, then it will have the same effect as calling :Refresh()


You are right. Instead try to replace

@ 7, 370 SAY oPAGE PROMPT cPageNum ;


with

@ 7, 370 SAY oPAGE PROMPT TXT_PAGENUM+ltrim(str(nPage,4,0)) + " / " + ltrim(str(len(aFiles))) ;


EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TSay
Posted: Mon Dec 25, 2006 10:54 AM

Enrico,

Yes, thats a better solution. Thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion