Date scrollbar

Date scrollbar

Postby Silvio.Falconi » Thu Apr 21, 2022 9:03 pm

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 view  RUN
@ 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 view  RUN
@ 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)) }
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: 7062
Joined: Thu Oct 18, 2012 7:17 pm

Re: Date scrollbar

Postby Jimmy » Fri Apr 22, 2022 3:18 am

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 view  RUN
   DoCompare(oScroll_dFirst,oScroll_dLast), ;
   Refresh_dbfx()

compare both Value of Object and "re-position" if need
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Date scrollbar

Postby Silvio.Falconi » Sat Apr 23, 2022 4:27 pm

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 view  RUN
   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 view  RUN
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 view  RUN
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
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: 7062
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 78 guests