SET RANGE ERROR - RESOLVED!!!

Post Reply
User avatar
Silvio.Falconi
Posts: 7140
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

SET RANGE ERROR - RESOLVED!!!

Post by Silvio.Falconi »

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


 ::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

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
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: SET RANGE ERROR

Post by James Bott »

Silvio,

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

Code: Select all | Expand

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
Silvio.Falconi
Posts: 7140
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: SET RANGE ERROR

Post by Silvio.Falconi »

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

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


@  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
Enrico Maria Giordano
Posts: 8756
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: SET RANGE ERROR

Post by Enrico Maria Giordano »

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

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

Eval( ::bChange, Self )


EMG
User avatar
Silvio.Falconi
Posts: 7140
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: SET RANGE ERROR

Post by Silvio.Falconi »

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

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

@  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
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: SET RANGE ERROR

Post by nageswaragunupudi »

Please try:

Code: Select all | Expand

ON CHANGE If( oDtpLast == nil, nil, ( oDtpLast:SetRange( dFirst ), oGrS1:Update() ) )
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 7140
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: SET RANGE ERROR

Post by Silvio.Falconi »

nageswaragunupudi wrote:Please try:

Code: Select all | Expand

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
Post Reply