Bug in TSay

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Bug in TSay

Post by Enrico Maria Giordano »

The following sample shows the problem:

Code: Select all

#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

Code: Select all

::VarPut( ::cCaption )
added in the latest TSay class.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

This looks as a right fix for rpreview.prg:

Code: Select all

     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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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

Code: Select all

@ 7, 370 SAY oPAGE PROMPT cPageNum ;
with

Code: Select all

@ 7, 370 SAY oPAGE PROMPT TXT_PAGENUM+ltrim(str(nPage,4,0)) + " / " + ltrim(str(len(aFiles))) ;
EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

Yes, thats a better solution. Thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply