Page 1 of 1

New TdatePick error FWH 20.04 - Resolved!! -

Posted: Mon May 04, 2020 8:50 am
by Silvio.Falconi
I tested the class into a Ribbonbar but it make me error on SetRange

Code: Select all

Error occurred at: 04-05-2020, 10:49:40
   Error description: Error BASE/1004  Metodo non disponibile: SETRANGE
   Args:
     [   1] = U   
     [   2] = D   04-05-2020

Stack Calls
===========
   Called from:  => SETRANGE( 0 )
   Called from: test.prg => (b)BUILDRIBBONBAR( 92 )
   Called from: .\source\classes\TDTPICKE.PRG => TDATEPICK:CHANGE( 454 )
   Called from: .\source\classes\TDTPICKE.PRG => TDATEPICK:_CTEXT( 396 )
   Called from: .\source\classes\TDTPICKE.PRG => TDATEPICK:NEW( 180 )
   Called from: test.prg => BUILDRIBBONBAR( 92 )
   Called from: test.prg => TEST( 52 )
   Called from: test.prg => MAIN( 30 )

the test

Code: Select all

#include "fivewin.ch"
#include "constant.ch"
#include "ord.ch"
#include "dtpicker.ch"
#include "ribbon.ch"

REQUEST HB_Lang_IT
REQUEST HB_CODEPAGE_ITWIN


REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO

static dDataIniziale,dDataFinale,lShowNumeri,lshowPagamenti
static oWndMain,cIniFile,oRebar

FUNCTION Main()

    HB_LangSelect("IT")
    HB_SetCodePage("ITWIN")

    SET _3DLOOK ON
    SET CENTURY ON
    SET DATE ITALIAN

    RDDSetDefault( 'DBFCDX' )


    test()


   RETURN NIL

//--------------------------------------------------//


Function test()
   local oFont
   cIniFile    :=  cFilePath( GetModuleFileName( GetInstance() ) ) + "test.ini"


DEFINE WINDOW oWndMain   ;
      TITLE "test"


         dDataIniziale  := date()
         dDataFinale    := date()
         lShowNumeri    := .t.
         lshowPagamenti := .f.

            BuildRibbonBar()

             activate()

return nil
//--------------------------------------------------//

Function BuildRibbonBar()
local aRbPrompts:={"Spiaggia","Planner","Gestione","Stampe","Visualizza","Configurazione","Strumenti"}
local oGrS1

     local dMin     := {^ 2020/03/05 }
     local dMax     := {^ 2020/03/20 }
     local dFirst   := {^ 2020/03/07 }
     local dLast    := {^ 2020/03/10 }
     local oDtpFirst, oDtpLast



local nAltezzaRibbon:= 134



 oRebar := TRibbonBar():New(oWndMain, aRbPrompts,,,,nAltezzaRibbon,22,CLR_WHITE,RGB(165,186,204),,,,,,,,.T.,)

 DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-16

 ADD GROUP oGrS1 RIBBON oRebar TO OPTION 1  WIDTH 625 PROMPT "Periodo da visualizzare"



     @  30, 30 DTPICKER oDtpFirst VAR dFirst SIZE 200,28 PIXEL OF oGrS1 ;
      PICTURE "ddd dd mmm yyyy" ;
      ON CHANGE ( oDtpLast:SetRange( dFirst ), oGrS1:Update() )

   WITH OBJECT oDtpFirst
      :lNoToday         := .t.
      :lNoTodayCircle   := .t.
      :SetRange( dMin, dMax )
   END

   @  65, 30 BTNBMP PROMPT "-" SIZE 30,30 PIXEL OF oGrS1 FLAT ;
      ACTION ( dFirst--, oDtpFirst:SetFocus() )

   @  65,200 BTNBMP PROMPT "+" SIZE 30,30 PIXEL OF oGrS1 FLAT ;
      ACTION ( dFirst++, oDtpFirst:SetFocus() )

   @  30,250 DTPICKER oDtpLast VAR dLast SIZE 200,28 PIXEL OF oGrS1 ;
      PICTURE "ddd dd mmm yyyy" ON CHANGE oGrS1:Update()

   WITH OBJECT oDtpLast
      :lNoToday         := .t.
      :lNoTodayCircle   := .t.
      :SetRange( dFirst, dMax )
   END

   @  65,250 BTNBMP PROMPT "-" SIZE 30,30 PIXEL OF oGrS1 FLAT ;
      ACTION ( dLast--, oDtpLast:SetFocus() )
   @  65,420 BTNBMP PROMPT "+" SIZE 30,30 PIXEL OF oGrS1 FLAT ;
      ACTION ( dLast++, oDtpLast:SetFocus() )



return nil
//---------------------------------------------------------------------------------------//


Function activate()


ACTIVATE WINDOW oWndMain

return nil


//---------------------------------------------------------------------------------------//


//---------------------------------------------------------------------------------------//












 
how I can resolve it ?


I tested also on xbrowse

Code: Select all

      WITH OBJECT  oBrowse:aCols[ 8]
                  :nEditType:=  EDIT_DATE
                  :oEditGet:setrange(ctod("17/05/2020"),ctod("20/09/2020"))
                  :bOnChange := bCalcRow
               END
give me error setrange() not found

Re: New TdatePick error FWH 20.04

Posted: Tue May 05, 2020 8:06 am
by Silvio.Falconi
Nages,
I found the error

line

@ 30, 30 DTPICKER oDtpFirst VAR dFirst SIZE 200,28 PIXEL OF oGrS1 ;
PICTURE "ddd dd mmm yyyy" ;
ON CHANGE ( oDtpLast:SetRange( dFirst ), oGrS1:Update() )

If rem this line run ok

then I thinked ..

if I change with ( before oDtpLast control )

@ 30,250 DTPICKER oDtpLast VAR dLast SIZE 200,28 PIXEL OF oGrS1 ;
PICTURE "ddd dd mmm yyyy" ON CHANGE oGrS1:Update()


@ 30, 30 DTPICKER oDtpFirst VAR dFirst SIZE 200,28 PIXEL OF oGrS1 ;
PICTURE "ddd dd mmm yyyy" ;
ON CHANGE ( oDtpLast:SetRange( dFirst ), oGrS1:Update() )

run ok ... It's very strange

Re: New TdatePick error FWH 20.04

Posted: Wed May 06, 2020 3:31 pm
by Silvio.Falconi
the problem was on bchange of DATEPICK
because the bchange not found oDtpLast at first

@ 30,100 DTPICKER oDtpFirst VAR dFirst SIZE 200,28 PIXEL OF oGrS1 ;
PICTURE "ddd dd mmm yyyy"
* ON CHANGE ( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) this not run and blocked all

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

@ 30,340 DTPICKER oDtpLast VAR dLast SIZE 200,28 PIXEL OF oGrS1 ;
PICTURE "ddd dd mmm yyyy" ;
ON CHANGE ( SetDates( dFirst, dLast, lShowNumeri, lshowPagamenti ))

oDtpFirst:bchange:={ ||( oDtpLast:SetRange( dFirst ),oDtpLast:refresh(),oGrS1:Update())} I invented this line and it seems run ok


WITH OBJECT oDtpLast
:lNoToday := .t.
:lNoTodayCircle := .t.
:SetRange( dFirst, dStagioneMax )
END




or ( Itried to insert before oDtpLast )

Code: Select all

 

@  30,340 DTPICKER oDtpLast VAR dLast SIZE 200,28 PIXEL OF oGrS1 ;
      PICTURE "ddd dd mmm yyyy" ;
        ON CHANGE ( SetDates(  dFirst,  dLast, lShowNumeri, lshowPagamenti ))

         WITH OBJECT oDtpLast
      :lNoToday         := .t.
      :lNoTodayCircle   := .t.
      :SetRange( dFirst, dStagioneMax )
   END

   @  30,100 DTPICKER oDtpFirst VAR dFirst SIZE 200,28 PIXEL OF oGrS1 ;
      PICTURE "ddd dd mmm yyyy" ;
       ON CHANGE ( oDtpLast:SetRange( dFirst ), oGrS1:Update() )

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