FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Date scrollbar
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Date scrollbar

Posted: Thu Apr 21, 2022 09:03 PM
I have two scrollBar to select two dates



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 (fw): Select all Collapse
@ 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 (fw): Select all Collapse
 @ 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 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: 1772
Joined: Thu Sep 05, 2019 05:32 AM

Re: Date scrollbar

Posted: Fri Apr 22, 2022 03: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 (fw): Select all Collapse
    DoCompare(oScroll_dFirst,oScroll_dLast), ;
   Refresh_dbfx()

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

Jimmy
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: Date scrollbar

Posted: Sat Apr 23, 2022 04: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 (fw): Select all Collapse
    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 (fw): Select all Collapse
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 (fw): Select all Collapse
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 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