Page 1 of 1
problem dialog + title
Posted: Fri May 18, 2012 8:32 am
by Otto
Hello Antonio,
if we have a Dialog with a Title which has spaces at the beginning and at the end the program breaks without an error message.
Best regards,
Otto
Code: Select all
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oDlg, oBtn, oGet, cName := space(10)
DEFINE DIALOG oDlg FROM 5, 5 TO 15, 40 TITLE " A Dialog Box" + space(100)
@ 2, 2 GET oGet VAR cName SIZE 50, 12 OF oDlg
@ 4, 2 BUTTON oBtn PROMPT "&Aceptar" OF oDlg SIZE 40,12 ;
ACTION ( oBtn:oJump := oGet, oGet:SetFocus() )
@ 4,10 BUTTON "&Cancelar" OF oDlg SIZE 40,12 ;
ACTION oDlg:End()
ACTIVATE DIALOG oDlg
return nil
Re: problem dialog + title
Posted: Fri May 18, 2012 12:05 pm
by fafi
Hello Mr.Otto
Please don't use length of cTitle more than 114 char
yours code is " A Dialog Box" + space(100) = len(115)
please try this
Code: Select all
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local cTitle := spac(114)
local oDlg, oBtn, oGet, cName := space(10)
DEFINE DIALOG oDlg FROM 5, 5 TO 15, 40 TITLE " A Dialog Box" + space(100)
@ 2, 2 GET oGet VAR cName SIZE 50, 12 OF oDlg
@ 4, 2 BUTTON oBtn PROMPT "&Aceptar" OF oDlg SIZE 40,12 ;
ACTION ( oBtn:oJump := oGet, oGet:SetFocus() )
@ 4,10 BUTTON "&Cancelar" OF oDlg SIZE 40,12 ;
ACTION oDlg:End()
ACTIVATE DIALOG oDlg
return nil
regards
Fafi
Re: problem dialog + title
Posted: Fri May 18, 2012 12:38 pm
by Otto
Hello,
thank you. The problem is that for example you select the title from a dbf-file and a user has spaces then the program errors out.
As there is no error message it takes long to find out why.
I think this should be resolved inside the class.
Best regards,
Otto
Re: problem dialog + title
Posted: Fri May 18, 2012 1:32 pm
by Rick Lipkin
Otto
I understand your frustration .. I found this problem myself to be frustrating. I included in the dialog title my SQL queries ( debugging tool ) so I would know how my data was collected... some SQL queries were short .. some longer and I could not figure out why some dialogs just abruptly quit and some did not.
Through trial and error I realized it was the character length of my SQL queries being displayed on the Title bar that caused the problem so I eliminated them and learned not to use long Titles on dialogs ..
Just one of those things I categorize as a 'disturbance in the Force'
Rick Lipkin
Re: problem dialog + title
Posted: Fri May 18, 2012 1:46 pm
by fafi
Otto wrote:Hello,
thank you. The problem is that for example you select the title from a dbf-file and a user has spaces then the program errors out.
As there is no error message it takes long to find out why.
I think this should be resolved inside the class.
Best regards,
Otto
then use cTitle := alltrim(mydbf->cfield)
and left(cTitle,114)
DEFINE DIALOG oDlg FROM 5, 5 TO 15, 40 TITLE cTitle
![Laughing :lol:](./images/smilies/icon_lol.gif)
Re: problem dialog + title
Posted: Fri May 18, 2012 3:02 pm
by Antonio Linares
We are going to investigate why this happens, thanks!
![Smile :-)](./images/smilies/icon_smile.gif)