Bug in TSay

Bug in TSay

Postby Enrico Maria Giordano » Sun Dec 24, 2006 10:58 pm

The following sample shows the problem:

Code: Select all  Expand view
#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  Expand view
::VarPut( ::cCaption )


added in the latest TSay class.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in TSay

Postby Enrico Maria Giordano » Sun Dec 24, 2006 11:04 pm

Even during reports generation the counter is not updated anymore.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

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

Postby Antonio Linares » Mon Dec 25, 2006 1: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Dec 25, 2006 1:13 am

This looks as a right fix for rpreview.prg:
Code: Select all  Expand view
     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: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Mon Dec 25, 2006 9:14 am

Or just remove

Code: Select all  Expand view
oBar:Refresh()


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Mon Dec 25, 2006 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Mon Dec 25, 2006 9: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

Code: Select all  Expand view
@ 7, 370 SAY oPAGE PROMPT cPageNum ;


with

Code: Select all  Expand view
@ 7, 370 SAY oPAGE PROMPT TXT_PAGENUM+ltrim(str(nPage,4,0)) + " / " + ltrim(str(len(aFiles))) ;


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Mon Dec 25, 2006 10:54 am

Enrico,

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

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests