problem dialog + title

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

problem dialog + title

Post 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
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
fafi
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Re: problem dialog + title

Post 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
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: problem dialog + title

Post 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: problem dialog + title

Post 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
User avatar
fafi
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Re: problem dialog + title

Post 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
:roll:

then use cTitle := alltrim(mydbf->cfield)

and left(cTitle,114)

DEFINE DIALOG oDlg FROM 5, 5 TO 15, 40 TITLE cTitle
:lol:
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: problem dialog + title

Post by Antonio Linares »

We are going to investigate why this happens, thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply