SET RANGE ERROR - RESOLVED!!!

SET RANGE ERROR - RESOLVED!!!

Postby Silvio.Falconi » Thu May 13, 2021 7: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: Select all  Expand view

 ::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: Select all  Expand view
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
Last edited by Silvio.Falconi on Sat May 15, 2021 6:40 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: SET RANGE ERROR

Postby James Bott » 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: Select all  Expand view
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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: SET RANGE ERROR

Postby Silvio.Falconi » Fri May 14, 2021 7: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: Select all  Expand view
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: Select all  Expand view

@  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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: SET RANGE ERROR

Postby Enrico Maria Giordano » Fri May 14, 2021 9: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: Select all  Expand view
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: Select all  Expand view
Eval( ::bChange, Self )


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: SET RANGE ERROR

Postby Silvio.Falconi » Fri May 14, 2021 9: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: Select all  Expand view
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: Select all  Expand view
@  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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: SET RANGE ERROR

Postby nageswaragunupudi » Fri May 14, 2021 3:31 pm

Please try:
Code: Select all  Expand view
ON CHANGE If( oDtpLast == nil, nil, ( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: SET RANGE ERROR

Postby Silvio.Falconi » Sat May 15, 2021 6:39 am

nageswaragunupudi wrote:Please try:
Code: Select all  Expand view
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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests

cron