Page 1 of 1

Date scrollbar

Posted: Thu Apr 21, 2022 9:03 pm
by Silvio.Falconi
I have two scrollBar to select two dates

Image

both trackpos are placed in their respective number of records (recno ())
How can I do if when I move the second trackpos and it arrives in the same position as the first, I make the first move too? ( and viceversa)

I explain ...

it may happen that by moving the trackpos of the second scrollbar you arrive at the same date as the first scrollbar and to avoid that the second date is lower than the first how can I move the first track

the first scrollBar

Code: Select all | Expand

@ nRow, ncol SCROLLBAR oScroll_dFirst HORIZONTAL  SIZE 400,20 PIXEL  OF oDlg ;
    RANGE 1,ntotals_Init ;
     ON DOWN ( oDbf1:Skip(),;
                If( oDbf1:EoF(), oDbf1:GoBottom(),),;
                Refresh_dbf1(oSay,oDbf1,@dFirst,@nInit));
      ON UP  ( oDbf1:Skip( -1 ),Refresh_dbf1(oSay,oDbf1,@dFirst,@nInit)  )

    oScroll_dFirst:oCursor:=oCursorBtn
    oScroll_dFirst:bPOS = { | nPos | (oDbf1:GoTo( nPos ),;
                                    oScroll_dFirst:SetPos( nPos ),;
                                    oScroll_dFirst:refresh() ,;
                                    Refresh_dbf1(oSay,oDbf1,@dFirst,@nInit)) }



the second scrollbar

Code: Select all | Expand

@ nRow, ncol SCROLLBAR oScroll_dLast HORIZONTAL  SIZE 400,20 PIXEL  OF oDlg ;
    RANGE 1,ntotals_End ;
     ON DOWN ( oDbf2:Skip(),;
                If( oDbf2:EoF(), oDbf2:GoBottom(),),;
                Refresh_dbf2(oSay,oDbf2,@dLast,@nEnd));
      ON UP  ( oDbf2:Skip( -1 ),Refresh_dbf2(oSay,oDbf2,@dLast,@nEnd)  )
         oScroll_dLast:oCursor:=oCursorBtn
         oScroll_dLast:bPOS = { | nPos | (oDbf2:GoTo( nPos ),;
                                    oScroll_dLast:SetPos( nPos ),;
                                    oScroll_dLast:refresh(),;
                                    Refresh_dbf2(oSay,oDbf2,@dLast,@nEnd)) }

Re: Date scrollbar

Posted: Fri Apr 22, 2022 3:18 am
by Jimmy
hi Silvio,

if you want to "use" 2 x Control you must pass both Object to compare Position

when "first scrollBar" and "second scrollbar" are in same PRG

Code: Select all | Expand

   DoCompare(oScroll_dFirst,oScroll_dLast), ;
   Refresh_dbfx()

compare both Value of Object and "re-position" if need

Re: Date scrollbar

Posted: Sat Apr 23, 2022 4:27 pm
by Silvio.Falconi
Jimmy wrote:hi Silvio,

if you want to "use" 2 x Control you must pass both Object to compare Position

when "first scrollBar" and "second scrollbar" are in same PRG

Code: Select all | Expand

   DoCompare(oScroll_dFirst,oScroll_dLast), ;
   Refresh_dbfx()

compare both Value of Object and "re-position" if need


Jimmy,
I allready made a function but it not run ok

Code: Select all | Expand

Function  CheckDate(nPos,oScroll_dFirst,dlast,dFirst,oDbf1,nInit,oSay)
   IF dlast<dFirst
        oScroll_dFirst:SetPos( nPos )
        oScroll_dFirst:refresh()
        nInit:=npos
        Refresh_dbf1(oSay,oDbf1,@dFirst,@nInit)
     Endif
 return nil


I believe instead that there is a problem in the visualization of the scrollbar control with the windows manifest
because it is very unstable at least on win10 that is, it does not respond well to mouse commands


I tried also with

Code: Select all | Expand

function DoCompare(oScroll_dFirst,oScroll_dLast,;
                      nInit,nEnd,;
                      dFirst,dLast,;
                      oDbf1,oDbf2,oSay)

   local nPos1:=oScroll_dFirst:getPos()
   local nPos2:=oScroll_dLast:getPos()

   IF nPos2<nPos1
      oScroll_dFirst:setPos( nPos2 )
      oScroll_dFirst:refresh()
   Endif



    Refresh_dbf1(oSay,oDbf1,@dFirst,@nInit)
    Refresh_dbf2(oSay,oDbf2,@dLast,@nEnd)

Return nil


but not run ok

I have not found any example on fwh \ sample with one or more scrollbar objects moving a database