FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SET RANGE ERROR - RESOLVED!!!
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
SET RANGE ERROR - RESOLVED!!!
Posted: Thu May 13, 2021 07:15 AM
I had made a small text in a dialog taking the example of Nages dtprang1.prg
as you can see on this topic viewtopic.php?f=3&t=40344&sid=096b78133ff43210636e86df0f01f042#p240896

I inserted the piece of the two controls above a ribbonbar as created by Nages (changing only the position coordinates of the controls)

always makes me the same ERROR SETRANGE()

AT THIS LINE

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

oGrS1 ia group tab of the ribbonbar

Code (fw): Select all Collapse
 ::oRebar := TRibbonBar():New(::oWndMain, aRbPrompts,,,,nAltezzaRibbon,30,,,,,,,,,,.T.,)
...

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


 @  20,69 SAY "Dal:"  SIZE 30,28 PIXEL OF oGrS1 FONT oFont TRANSPARENT
  @  20,310 SAY "al :"  SIZE 30,28 PIXEL OF oGrS1 FONT oFont TRANSPARENT


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

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


    @  55, 100 ADD BUTTON oBtnDdate[1]  ;
                  BITMAP aBtnfw[2] ;
                  GROUP oGrS1  SIZE 28,25;
                  ACTION ( dFirst--,oDtpFirst:refresh(), oDtpFirst:SetFocus() )

    @  55,275 ADD BUTTON oBtnDdate[2]  ;
                  BITMAP aBtnfw[1] ;
                  GROUP oGrS1  SIZE 28,25;
                  ACTION ( dFirst++,oDtpFirst:refresh(), oDtpFirst:SetFocus() )

        oBtnDdate[1]:ocursor :=oHand
        oBtnDdate[2]:ocursor :=oHand



    @  20,340 DTPICKER oDtpLast VAR dLast SIZE 200,28 PIXEL OF oDlg ;
      PICTURE "ddd dd mmm yyyy"  UPDATE //ON CHANGE ( oDlg:Update(),oBrowse:refresh())

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

   
      @  55,340 ADD BUTTON oBtnDdate[3]  ;
                  BITMAP aBtnfw[2] ;
                  GROUP oGrS1  SIZE 28,25;
                  ACTION ( dLast--,oDtpLast:refresh(), oDtpLast:SetFocus() )
   @  55,515 ADD BUTTON oBtnDdate[4]  ;
                  BITMAP aBtnfw[1] ;
                  GROUP oGrS1  SIZE 28,25;
                  ACTION ( dLast++,oDtpLast:refresh(), oDtpLast:SetFocus() )

       oDtpLast:bchange := { || SetDates(  dFirst,  dLast, lShowNumeri, lshowPagamenti )}


      oBtnDdate[3]:ocursor :=oHand
      oBtnDdate[4]:ocursor :=oHand




I also check if there is an error on dates and I insert on source

dFirst := {^ 2021/04/08 }
dLast := {^ 2021/04/08 }

now I don't understand why in the dialog function and in the ribbonbar it doesn't work as is possible ??????

it is as if first it cannot bchange oDtpFirst exiting with an error to SetRange ()

the error.log
Code (fw): Select all Collapse
Application
===========
   Path and name: C:\Work\Prg\Prenotazioni\WinBeach.Exe (32 bits)
   Size: 7,182,848 bytes
   Compiler version: Harbour 3.2.0dev (r1904111533)
   FiveWin  version: FWH 21.02
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 0 mins 5 secs 
   Error occurred at: 13-05-2021, 09:03:18
   Error description: Error BASE/1004  Metodo non disponibile: SETRANGE
   Args:
     [   1] = U   
     [   2] = D   08-04-2021

Stack Calls
===========
   Called from:  => SETRANGE( 0 )
   Called from: source\sistema\main.prg => (b)TAPPLICATION_BUILDRIBBONBAR( 868 )
   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: source\sistema\main.prg => TAPPLICATION:BUILDRIBBONBAR( 868 )
   Called from: source\sistema\main.prg => TAPPLICATION:NEW( 413 )
   Called from: source\sistema\main.prg => MAIN( 64 )


If I rem that line I wrote above and insert this line

oDtpFirst:bchange := { ||( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) }

at the end before of oDtpLast:bchange := { || SetDates( dFirst, dLast, lShowNumeri, lshowPagamenti )}



not make error , I's very very strange


a solution please
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: SET RANGE ERROR
Posted: Thu May 13, 2021 11:36 PM
Silvio,

This is exactly the same problem we discussed a few days ago. The objects are invisible inside the codeblock.

Code (fw): Select all Collapse
oDtpFirst:bchange := { ||( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) }


You have to pass the objects, so rewrite the above line like this.

oDtpFirst:bchange := { | oDtplast, oGrs1 |( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) }
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: SET RANGE ERROR
Posted: Fri May 14, 2021 07:09 AM
James Bott wrote:Silvio,

This is exactly the same problem we discussed a few days ago. The objects are invisible inside the codeblock.

Code (fw): Select all Collapse
oDtpFirst:bchange := { ||( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) }


You have to pass the objects, so rewrite the above line like this.

oDtpFirst:bchange := { | oDtplast, oGrs1 |( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) }



James,
NO, this is not the piece that didn't work

but the piece that didn't work is this:

Code (fw): Select all Collapse
@  20,100 DTPICKER oDtpFirst VAR dFirst SIZE 200,28 PIXEL OF oGrS1 ;
      PICTURE "ddd dd mmm yyyy" ;
       ON CHANGE ( oDtpLast:SetRange( dFirst ), oGrS1:Update() )  UPDATE


then now I converte this line (ON CHANGE) in
oDtpFirst:bchange := { ||( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) } or oDtpFirst:bchange := { | oDtplast, oGrs1 |( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) }

But if you insert this line before of the odtplast control not run
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: SET RANGE ERROR
Posted: Fri May 14, 2021 09:07 AM
James Bott wrote:Silvio,

This is exactly the same problem we discussed a few days ago. The objects are invisible inside the codeblock.

Code (fw): Select all Collapse
oDtpFirst:bchange := { ||( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) }


You have to pass the objects, so rewrite the above line like this.

oDtpFirst:bchange := { | oDtplast, oGrs1 |( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) }


No, you can't, as at the time of the evaluation of bChange only the object itself is passed to the codeblock:

Code (fw): Select all Collapse
Eval( ::bChange, Self )


EMG
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: SET RANGE ERROR
Posted: Fri May 14, 2021 09:21 AM
Enrico Maria Giordano wrote:

No, you can't, as at the time of the evaluation of bChange only the object itself is passed to the codeblock:

Code (fw): Select all Collapse
Eval( ::bChange, Self )


EMG


I can't do what? Enrico did not understand
I have the example of nages look at the file dtprang1.prg you can found on samples folder
and I inserted the same code on a ribbonbar

because on the dialog it runs well and on the ribbonbar it makes an error setrange()?

this is the subject of the discussion
forget it as I tried to fix the code to load the bchange that's another thing

I find that this piece does not work on the ribbonbar

Code (fw): Select all Collapse
@  20,100 DTPICKER oDtpFirst VAR dFirst SIZE 200,28 PIXEL OF oGrS1 ;
      PICTURE "ddd dd mmm yyyy" ;
       ON CHANGE ( oDtpLast:SetRange( dFirst ), oGrS1:Update() )  UPDATE


because odtplast is probably not created yet and make error on setrange()
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: SET RANGE ERROR
Posted: Fri May 14, 2021 03:31 PM
Please try:
Code (fw): Select all Collapse
ON CHANGE If( oDtpLast == nil, nil, ( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) )
Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: SET RANGE ERROR
Posted: Sat May 15, 2021 06:39 AM
nageswaragunupudi wrote:Please try:
Code (fw): Select all Collapse
ON CHANGE If( oDtpLast == nil, nil, ( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) )

Thanks Rao , you are a genius
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion