problem dialog + title

problem dialog + title

Postby Otto » Fri May 18, 2012 8:32 am

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  Expand view
#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
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: problem dialog + title

Postby fafi » Fri May 18, 2012 12:05 pm

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  Expand view


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

Re: problem dialog + title

Postby Otto » Fri May 18, 2012 12:38 pm

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
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: problem dialog + title

Postby Rick Lipkin » Fri May 18, 2012 1:32 pm

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
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: problem dialog + title

Postby fafi » Fri May 18, 2012 1:46 pm

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

Re: problem dialog + title

Postby Antonio Linares » Fri May 18, 2012 3:02 pm

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
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 103 guests