FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos Bug in TDialog title [Solved]
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TDialog title [Solved]
Posted: Fri Feb 14, 2014 12:52 PM
The following sample demonstrates the problem. It doesn't show the dialog (tested under Win 8.1). It works correctly with a title up to 114 characters. In dialog.prg there is a check for maximum size of 140 characters. It should be lower to 114.

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

聽 聽 LOCAL oDlg

聽 聽 DEFINE DIALOG oDlg;
聽 聽 聽 聽 聽 聽TITLE REPLICATE( "X", 115 )

聽 聽 ACTIVATE DIALOG oDlg;
聽 聽 聽 聽 聽 聽 聽CENTER

聽 聽 RETURN NIL


EMG
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in TDialog title
Posted: Fri Feb 14, 2014 09:03 PM

The following sample demonstrates the problem. It doesn't show the dialog (tested under Win 8.1). It works correctly with a title up to 114 characters. In dialog.prg there is a check for maximum size of 140 characters. It should be lower to 114.


Enrico

I use Windows 8.1 and Fwh 13.12
The version that appears Fivewin image is incorrect
Image suit.
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TDialog title
Posted: Fri Feb 14, 2014 09:08 PM

Cristobal,

are you using Win 8.1 64 bit? If yes, can you send me your EXE to test it here?

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in TDialog title
Posted: Fri Feb 14, 2014 09:24 PM

Enrico
I've sent you an email

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TDialog title
Posted: Fri Feb 14, 2014 10:10 PM

Cristobal,

received and already answered! :-)

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in TDialog title
Posted: Fri Feb 14, 2014 11:10 PM
Enrico Maria Giordano wrote:Cristobal,

received and already answered! :-)

EMG


I answered
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TDialog title
Posted: Sat Feb 15, 2014 11:00 AM
Some other clues. The following sample does work fine:

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg;
//           TITLE REPLICATE( "X", 115 )

//    oDlg:cCaption = REPLICATE( "X", 115 )

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetText( REPLICATE( "X", 500 ) );
             CENTER

    RETURN NIL


It doesn't if you comment out ON INIT clause and uncomment one of the two commented lines. Please note that there is a check for a maximum of 140 characters in TDialog cCaption (that does not trim my 500 characters string) which seems unuseful now.

Any ideas?

EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TDialog title
Posted: Sat Feb 15, 2014 11:25 AM

I traced the problem. It seems to be inside cDlg2Chr() function, probably in the calculation of wSize. But I guess we have to wait for Antonio to fix this.

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in TDialog title
Posted: Sat Feb 15, 2014 11:54 AM
Enrico
It is true
Fw cCaption Controls the length of the dialogue in the first case
Code (fw): Select all Collapse
DEFINE DIALOG oDlg TITLE REPLICATE( "X", 415 )


In this second case, the length is not controlled
Code (fw): Select all Collapse
聽 聽 DEFINE DIALOG oDlg //TITLE REPLICATE( "X", 415 )
聽 聽 oDlg:cCaption = REPLICATE( "X", 415 )


In this third case, the length is not controlled
Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

聽 聽 LOCAL oDlg

聽 聽 DEFINE DIALOG oDlg //TITLE REPLICATE( "X", 415 )

聽 聽 //oDlg:cCaption = REPLICATE( "X", 415 )

聽 聽 ACTIVATE DIALOG oDlg; 
聽 聽 聽 聽 聽 聽 聽ON INIT oDlg:SetText( REPLICATE( "X", 500 ) );
聽 聽 聽 聽 聽 聽 聽VALID (Msginfo( Len( oDlg:cCaption ) ), .T. );
聽 聽 聽 聽 聽 聽 聽CENTER

聽 聽 RETURN NIL


One possible solution would be to add at the end of the Initiate method of TDialog: (no activate method)

Code (fw): Select all Collapse
聽 聽if ::bInit != nil
聽 聽 聽 lResult = Eval( ::bInit, Self )
聽 聽 聽 if ValType( lResult ) == "L" .and. ! lResult
聽 聽 聽 聽 聽lFocus = .f.
聽 聽 聽 endif
聽 聽endif

// Add
聽 if len( ::cCaption ) > 140
聽 聽 聽::cCaption := Left( ::cCaption , 140 )
聽 聽 聽::SetText( ::cCaption )
聽 endif


It's an idea and I have not tried yet


Tried
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TDialog title
Posted: Sat Feb 15, 2014 01:40 PM

Cristobal,

The third case works fine so the problem is not related to the length checking. As I already wrote, the problem is in cDlg2Chr() function. Once it is fixed, we can probably remove the length checking.

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in TDialog title
Posted: Sat Feb 15, 2014 01:46 PM

Enrico
If I had understood what you have written
My proposal is a temporary solution
I've already tried

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TDialog title
Posted: Sat Feb 15, 2014 02:05 PM

Cristobal,

We need of a real solution.

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TDialog title
Posted: Sat Feb 15, 2014 03:18 PM

Found! It seems that the correct solution is:

WORD wSize = sizeof( DIALOG_RES ) + ( hb_parclen( 6 ) * 2 ) +
1 + 2 + ( hb_parclen( 9 ) * 2 ) + 3 + 1;

Please note the + 1 at the end of the line. With it I can use a title of 10000 characters without problems! :-)

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in TDialog title
Posted: Sat Feb 15, 2014 05:39 PM

Enrico

Great, fine

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TDialog title
Posted: Sat Feb 15, 2014 09:50 PM
Enrico Maria Giordano wrote:Found! It seems that the correct solution is:

WORD wSize = sizeof( DIALOG_RES ) + ( hb_parclen( 6 ) * 2 ) +
1 + 2 + ( hb_parclen( 9 ) * 2 ) + 3 + 1;

Please note the + 1 at the end of the line. With it I can use a title of 10000 characters without problems! :-)

EMG


No! Unfortunately this is not the right fix, sorry. :-)

Ok, I will wait for Antonio... :-)

EMG