Page 1 of 1

Error of text on a dialog- RESOLVED!!

Posted: Sun Jun 28, 2020 5:05 pm
by Silvio.Falconi
I can't refresh a text created with a say control


Image

I put "UPDATE" con control say and I used settext funcion to refresh the text

why not run ok ?


this is the test
try to select two days

Code: Select all

#include "Fivewin.ch"
#include "dtpicker.ch"

static dfirst,dLast

Function test()
local oDlg, oFont,oLarge,oBold
local oFolder,oFld
local oDtpFirst, oDtpLast
local dStagioneMin,dStagioneMax
local nGiorni:= 1,oGiorni,oGiornitext

SET DATE ITALIAN
    SET CENTURY ON
   dFirst       := date()
   dLast        := date()
   dStagioneMin := ctod("17/06/2020")
   dStagioneMax := ctod("20/09/2020")

 DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-16
   DEFINE FONT oBold NAME "Segoe UI" SIZE 0,-14  BOLD
   DEFINE FONT oLarge NAME "VERDANA" SIZE 0,-24 BOLD

   DEFINE DIALOG oDlg SIZE 1130,650  PIXEL  FONT oFont ;
      TITLE "Test"   ;
        STYLE nOR(  WS_CAPTION, WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME )



      @  1, 0 FOLDEREX oFolder OF oDlg SIZE oDlg:nWidth-585,oDlg:nHeight-390 PIXEL  ;
        PROMPT "Prenotazioni","Pagamenti","Familiari"

@ 6,120 SAY "Dal :"  SIZE 20,11 PIXEL OF oFolder:aDialogs[1]  TRANSPARENT FONT oBold
    @ 23,120 SAY "al :"  SIZE 20,11 PIXEL OF oFolder:aDialogs[1]   TRANSPARENT FONT oBold

  @  3, 145 DTPICKER oDtpFirst VAR dFirst SIZE 90,12 PIXEL OF oFolder:aDialogs[1] ;
      PICTURE "ddd dd mmm yyyy" UPDATE;
      ON CHANGE ( oDtpLast:SetRange( dFirst ), oDlg:Update() )

    WITH OBJECT oDtpFirst
      :lNoToday         := .t.
      :lNoTodayCircle   := .t.
      :SetRange( dStagioneMin,dStagioneMax )
   END


     @  22,145 DTPICKER oDtpLast VAR dLast SIZE 90,12 PIXEL OF oFolder:aDialogs[1] ;
      PICTURE "ddd dd mmm yyyy"  UPDATE ;
      ON CHANGE  Rinfresca(@oGiorni,@oGiorniText,dFirst,dLast)




 @ 08.6,300 SAY oGiorni Prompt nGiorni  SIZE 38,20 PIXEL OF oFolder:aDialogs[1];
                FONT oLarge color RGB( 165, 186, 204 ) center UPDATE

    @ 08.6,300 SAY oGiornitext  Prompt (if( nGiorni>1,"giorni","giorno")) ;
                  SIZE 50,16 PIXEL OF oFolder:aDialogs[1] FONT oLarge;
                  color RGB( 165, 186, 204 ) UPDATE


                  oDlg:bResized  := <||
                     oRect                := oDlg:GetCliRect()
                     oFolder:nWidth       := oRect:nRight-2
                     oFolder:nHeight      := oRect:nBottom-160
                     oGiorni:nTop       :=  oFolder:ntop +4
                     oGiorni:nLeft      :=  oFolder:nleft+480
                     oGiorniText:nTop   :=  oFolder:ntop +44
                     oGiorniText:nLeft  :=  oFolder:nleft+480

                      return nil
                            >

ACTIVATE DIALOG oDlg CENTERED
return nil 
//-------------------------------------------------------------------//


Function Rinfresca(oGiorni,oGiorniText,dFirst,dLast)

local nGiorni:=(dLast-dFirst)+1
oGiorni:Settext(ltrim(str(nGiorni)))
               oGiorni:refresh()
               oGiornitext:Settext(if( nGiorni>1,"giorni","giorno"))
               oGiornitext:refresh()


return nil


 

Re: Error of text on a dialog

Posted: Sun Jun 28, 2020 5:42 pm
by alerchster
Hi

Delete this two lines

Code: Select all

Function Rinfresca(oGiorni,oGiorniText,dFirst,dLast)

local nGiorni:=(dLast-dFirst)+1
oGiorni:Settext(ltrim(str(nGiorni)))
 //              oGiorni:refresh()
               oGiornitext:Settext(if( nGiorni>1,"giorni","giorno"))
 //              oGiornitext:refresh()


return nil
 

Re: Error of text on a dialog

Posted: Sun Jun 28, 2020 5:47 pm
by Otto
Hello Silvio,
I myself noticed problems with settext.

Try

Code: Select all

Function Rinfresca(oGiorni,oGiorniText,dFirst,dLast)

   local nGiorni:=(dLast-dFirst)+1
     //  oGiorni:Settext(ltrim(str(nGiorni)))
   oGiorni:cTitle(ltrim(str(nGiorni)))
   //     oGiorni:refresh()
   oGiornitext:Settext(if( nGiorni>1,"giorni","giorno"))
   oGiornitext:refresh()
return nil


 
Best regards,
Otto

Re: Error of text on a dialog

Posted: Sun Jun 28, 2020 6:50 pm
by Otto
Hallo Anton,
ich hoffe du hast den "Lock-Down" gut überstande.
Vielleicht gelingt es doch, dass wir uns einmal persönlich kennen lernen.


We have to find out why
METHOD Refresh() INLINE If( ::bGet != nil, ::SetText( Eval( ::bGet ) ),)
does not read ::cCaption of :settext() method.

Best regards,
Otto

Re: Error of text on a dialog

Posted: Mon Jun 29, 2020 11:07 am
by Silvio.Falconi
alerchster wrote:Hi

Delete this two lines

Code: Select all

Function Rinfresca(oGiorni,oGiorniText,dFirst,dLast)

local nGiorni:=(dLast-dFirst)+1
oGiorni:Settext(ltrim(str(nGiorni)))
 //              oGiorni:refresh()
               oGiornitext:Settext(if( nGiorni>1,"giorni","giorno"))
 //              oGiornitext:refresh()


return nil
 
thanks

Re: Error of text on a dialog

Posted: Tue Jun 30, 2020 5:20 am
by nageswaragunupudi

Code: Select all

   @  3, 145 DTPICKER oDtpFirst VAR dFirst SIZE 90,12 PIXEL OF oFolder:aDialogs[1] ;
      PICTURE "ddd dd mmm yyyy" UPDATE;
      ON CHANGE ( oDtpLast:SetRange( dFirst ), oDlg:Update() )

   WITH OBJECT oDtpFirst
      :lNoToday         := .t.
      :lNoTodayCircle   := .t.
      :SetRange( dStagioneMin,dStagioneMax )
   END

   @  22,145 DTPICKER oDtpLast VAR dLast SIZE 90,12 PIXEL OF oFolder:aDialogs[1] ;
      PICTURE "ddd dd mmm yyyy"  UPDATE ;
      ON CHANGE  oDlg:Update()  //Rinfresca(@oGiorni,@oGiorniText,dFirst,dLast) : Remove this function

   @ 08.6,300 SAY { || nGiorni := dLast - dFirst + 1 } SIZE 38,20 PIXEL OF oFolder:aDialogs[1];
                FONT oLarge color RGB( 165, 186, 204 ) center UPDATE

   @ 08.6,300 SAY { || If( nGiorni>1,"giorni","giorno") } ;
                  SIZE 50,16 PIXEL OF oFolder:aDialogs[1] FONT oLarge;
                  color RGB( 165, 186, 204 ) UPDATE
 
function Rinfresca is not required.

Re: Error of text on a dialog

Posted: Tue Jun 30, 2020 7:16 am
by Silvio.Falconi
nageswaragunupudi wrote:

Code: Select all

   @  3, 145 DTPICKER oDtpFirst VAR dFirst SIZE 90,12 PIXEL OF oFolder:aDialogs[1] ;
      PICTURE "ddd dd mmm yyyy" UPDATE;
      ON CHANGE ( oDtpLast:SetRange( dFirst ), oDlg:Update() )

   WITH OBJECT oDtpFirst
      :lNoToday         := .t.
      :lNoTodayCircle   := .t.
      :SetRange( dStagioneMin,dStagioneMax )
   END

   @  22,145 DTPICKER oDtpLast VAR dLast SIZE 90,12 PIXEL OF oFolder:aDialogs[1] ;
      PICTURE "ddd dd mmm yyyy"  UPDATE ;
      ON CHANGE  oDlg:Update()  //Rinfresca(@oGiorni,@oGiorniText,dFirst,dLast) : Remove this function

   @ 08.6,300 SAY { || nGiorni := dLast - dFirst + 1 } SIZE 38,20 PIXEL OF oFolder:aDialogs[1];
                FONT oLarge color RGB( 165, 186, 204 ) center UPDATE

   @ 08.6,300 SAY { || If( nGiorni>1,"giorni","giorno") } ;
                  SIZE 50,16 PIXEL OF oFolder:aDialogs[1] FONT oLarge;
                  color RGB( 165, 186, 204 ) UPDATE
 
function Rinfresca is not required.

Nages,
Why the bchange of datepick Is execute before on anothers function Is on odlg init ?

Re: Error of text on a dialog

Posted: Tue Jun 30, 2020 9:11 am
by Otto
Dear Mr. Rao,
is
METHOD Refresh() INLINE If( ::bGet != nil, ::SetText( Eval( ::bGet ) ),)
reading ::cCaption of :settext() method.
Thank you in advance
Otto