FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help for scrollBar - Resolved -
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Help for scrollBar - Resolved -
Posted: Sun Apr 17, 2022 10:43 PM

I wish use scrollbar on a dialog

@ nRow, ncol SCROLLBAR oScrollInizio HORIZONTAL SIZE 400,20 PIXEL OF oDlg ;
RANGE 1,reccount() ;
ON DOWN ( dbSkip(),;
If( EoF(), dbGoBottom(),) );
ON UP ( dbSkip( -1 ) )

this run ok but the thmbpos is not stuck where it should be

How I can set the command ON THUMBPOS so that when I move the thumbpos it gives me the exact position in the archive?

I have not found any example in fw \ sample that uses scrollbar with a dbf

i try with
@ nRow, ncol SCROLLBAR oScrollInizio HORIZONTAL SIZE 400,20 PIXEL OF oDlg ;
RANGE 1,reccount() ;
ON DOWN ( dbSkip(),;
If( EoF(), dbGoBottom(),), Rinfresca(oSay) );
ON UP ( dbSkip( -1 ),Rinfresca(oSay) ) ;
ON THUMBPOS (DBGOTO(oScrollInizio:getpos()) ,;
If( EoF(), dbGoBottom(),), Rinfresca(oSay) ) UPDATE

But not run ok

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: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Help for scrollBar
Posted: Mon Apr 18, 2022 10:44 AM
I need to move the track so that when I move it with the mouse it could position itself on the oDbf record, How resolve it ?




this my sample

Code (fw): Select all Collapse
#include "fivewin.ch"

REQUEST DBFCDX
REQUEST HB_LANG_IT
REQUEST HB_CODEPAGE_ITWIN

FUNCTION Main()


   RddSetDefault( "DBFCDX" )

   SetHandleCount( 100 )

   SET DATE FORMAT "dd-mm-yyyy"
   SET DELETED     ON
   SET CENTURY     ON
   SET EPOCH TO    year( date() ) - 20
   SET MULTIPLE    OFF

   HB_LangSelect("IT")

      test()

RETURN nil

//--------------------------------------------------------------------//

Function test()
local oDlg,oFont,oBold,odbf
local oSay:=array(2)
local nRow
local ncol
local cCustomerInit
local ntotali_records
local cTitle:= "test sample with scrollbar"


     oDbf:=TDatabase():Open( , "Customer", "DBFCDX", .T. )
     oDbf:setorder(3)
     oDbf:goTop()

      cCustomerInit:= oDbf:First+" "+odbf:Last+" record n. "+ltrim(str(oDbf:ID))
      ntotali_records:=oDbf:OrdKeyCount()


    DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 14
    DEFINE FONT oBold NAME "MS Sans Serif" SIZE 0, 12 BOLD

 DEFINE DIALOG  oDlg ;
      SIZE 500, 250  PIXEL TRUEPIXEL RESIZABLE ;
      TITLE cTitle


     nRow:= 1
     ncol:= 2

    @ nRow, ncol Say oSay[1] Prompt "Customer : " of oDlg SIZE 200,14 PIXEL  FONT oBold
    @ nRow, nCol+150 Say oSay[2] Prompt cCustomerInit of oDlg SIZE 300,14 PIXEL  FONT oFont  UPDATE
    nRow+=40


    @ nRow, ncol SCROLLBAR oScrollInizio HORIZONTAL  SIZE 400,20 PIXEL  OF oDlg ;
    RANGE 1,oDbf:OrdKeyCount() ;
     ON DOWN ( oDbf:Skip(),;
                If( oDbf:EoF(), oDbf:GoBottom(),), Rinfresca(oSay,oDbf)  );
      ON UP   ( oDbf:Skip( -1 ),Rinfresca(oSay,oDbf) )

            oScrollInizio:bPOS = { | NPOS | (oDbf:GoTo( nPos ),Rinfresca(oSay,oDbf)) }
            oScrollInizio:bTRACK = { | NPOS | msgstop( 'btack block' ) }






     @ 100,10 BUTTON oBtnConfirm PROMPT "OK" of oDlg  SIZE 80,22 DEFAULT ACTION ( oDlg:end( IDOK  ) )
     @ 100,10 BUTTON oBtnClose PROMPT "Annulla" of oDlg  SIZE 80,22 CANCEL ACTION ( oDlg:end( IDCANCEL ) )

   oDlg:bResized  := <||
        local oRect        := oDlg:GetCliRect()

                oSay[1]:nLeft        := oRect:nRight - 200
                oSay[1]:nTop         := oRect:nTop+20
                oSay[2]:nLeft        := oRect:nRight - 200 
                oSay[2]:nTop         := oRect:nTop+20
                oScrollInizio:nTop   := oRect:nTop+40
                oScrollInizio:nLeft  := oRect:nRight - 400 
                oBtnConfirm:nLeft    := oRect:nRight - 200
                oBtnConfirm:nTop     := oRect:nBottom - 25
                oBtnClose:nLeft      := oRect:nRight - 100
                oBtnClose:nTop       := oRect:nBottom - 25

        return nil
        >

 ACTIVATE DIALOG oDlg center
RETURN NIL

//-----------------------------------------------------------------------------//


Function Rinfresca(oSay,oDbf)
local ccustomer :=  oDbf:First+" "+oDbf:Last+" record n. "+ltrim(str(oDbf:ID))

        oSay[2]:settext(ccustomer)

      return nil
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: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Help for scrollBar
Posted: Mon Apr 18, 2022 12:15 PM

Dear Silvio,

This way it works as expected:

        oScrollInizio:bPOS = { | NPOS | (oDbf:GoTo( nPos ), oScrollInizio:SetPos( nPos ), Rinfresca(oSay,oDbf)) }
        // oScrollInizio:bTRACK = { | NPOS | msgstop( 'btack block' ) }
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Help for scrollBar
Posted: Mon Apr 18, 2022 03:46 PM
Antonio Linares wrote:Dear Silvio,

This way it works as expected:

oScrollInizio:bPOS = { | NPOS | (oDbf:GoTo( nPos ), oScrollInizio:SetPos( nPos ), Rinfresca(oSay,oDbf)) }
// oScrollInizio:bTRACK = { | NPOS | msgstop( 'btack block' ) }



I cannot Move it with the mouse
it remains all to the left
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: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Help for scrollBar
Posted: Mon Apr 18, 2022 03:59 PM
Found the error
oDbf:=TDatabase():Open( , cDir+"dbf", "DBFCDX", .T. )
oDbf:setorder(1)
oDbf:gobottom()

nFine:= oDbf:recno()

oScrollDbf:bPOS = { | nPos | (oDbf:GoTo( nPos ),;
oScrollDbf:SetPos( nPos ),;
oScrollDbf:refresh(),;
Rinfresca(oDbf,oBrw,oSay)) }

and then

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oScrollDbf:SetPos(nFine ), <------------------

now run ok :-)
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: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Help for scrollBar
Posted: Mon Apr 18, 2022 04:41 PM

very good :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Help for scrollBar
Posted: Mon Apr 18, 2022 04:47 PM
Now I can move the track

If I move the track on the top ( all on the left) of the dbf then i cannot move it

Code (fw): Select all Collapse
@ 20, 5 SCROLLBAR oScrollDbf HORIZONTAL  SIZE 430,10 PIXEL  OF oDlg ;
    RANGE 1,oDbf:OrdKeyCount() ;
     ON DOWN ( oDbf:Skip(),    IIf( oDbf:EoF(), oDbf:GoBottom(),), Rinfresca(oDbf,oBrw,oSay)  );
      ON UP  ( oDbf:Skip( -1 ), Rinfresca(oDbf,oBrw,oSay)  )


    oScrollDbf:bPOS = { | nPos | (oDbf:GoTo( nPos ),;
                                   oScrollDbf:SetPos( nPos ),;
                                   oScrollDbf:refresh(),;
                                   Rinfresca(oDbf,oBrw,oSay)) }


I am using an archive of 10063 records.
I noticed a strange thing, if I move the track and I position myself in a number of records lower than the number 525 I can no longer move it, it seems frozen,
then if I press the ">" button of the scroll bar and I position myself at a number above the number 700 the track returns to work and I can move it with the mouse
See the video
What do you think depends on it?

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: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Help for scrollBar
Posted: Mon Apr 18, 2022 04:56 PM

Are you using an index ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Help for scrollBar
Posted: Mon Apr 18, 2022 05:13 PM
Antonio Linares wrote:Are you using an index ?


yes
oDbf:setorder(1) but the index are 2
DTOS(DATA)+CONCORSO
VAL(CONCORSO)

see the video pls
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: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Help for scrollBar
Posted: Wed Apr 20, 2022 09:39 AM


Notice that when I move the mouse (hand) at a certain point to the left with there is more the hand but the arrow
If I move all the way to the left, the track won't let me take it with the mouse
if I move with the cursor keys or by pressing ">" in the scrollbar and moving to the position of the hand I can resume the track with the mouse.
How do you think I can solve it?

the database is indexed with three indexes

1) DTOS(DATA)+CONCORSO
2) VAL(CONCORSO)
3) DATA

I also tried with setorder (0)

Code (fw): Select all Collapse
@ 20, 5 SCROLLBAR oScrollDbf HORIZONTAL  SIZE 430,10 PIXEL  OF oDlg ;
           RANGE 1,oDbf:RecCount() ;
     ON DOWN ( oDbf:Skip(),    IIf( oDbf:EoF(), oDbf:GoBottom(),), Rinfresca(oDbf,oBrw,oSay,nRadio,@afound,adata,aSelected,lValore)  );
      ON UP  ( oDbf:Skip( -1 ), Rinfresca(oDbf,oBrw,oSay,nRadio,@afound,adata,aSelected,lValore)  )

                      oScrollDbf:oCursor:=oCursorBtn
    oScrollDbf:bPOS = { | nPos | (oDbf:GoTo( nPos ),;
                                   oScrollDbf:SetPos( nPos ),;
                                   oScrollDbf:refresh(),;
                                   Rinfresca(oDbf,oBrw,oSay,nRadio,@afound,adata,aSelected,lValore)) }



I try also with
Code (fw): Select all Collapse
RANGE 1,oDbf:OrdKeyCount()
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: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Help for scrollBar
Posted: Mon Apr 25, 2022 11:45 AM
Antonio Linares wrote:Are you using an index ?



I found the error
there was the bitmap next to the given string covering part of the scrollbar
sorry
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