Help for scrollBar - Resolved -

Help for scrollBar - Resolved -

Postby Silvio.Falconi » 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
Last edited by Silvio.Falconi on Tue Apr 26, 2022 9:08 am, edited 3 times 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
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help for scrollBar

Postby Silvio.Falconi » 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 ?

Image


this my sample

Code: Select all  Expand view


#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 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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help for scrollBar

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Help for scrollBar

Postby Silvio.Falconi » Mon Apr 18, 2022 3: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 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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help for scrollBar

Postby Silvio.Falconi » Mon Apr 18, 2022 3: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 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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help for scrollBar

Postby Antonio Linares » Mon Apr 18, 2022 4:41 pm

very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Help for scrollBar

Postby Silvio.Falconi » Mon Apr 18, 2022 4: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: Select all  Expand view

@ 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?

Image
Last edited by Silvio.Falconi on Mon Apr 18, 2022 5:12 pm, edited 2 times 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
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help for scrollBar

Postby Antonio Linares » Mon Apr 18, 2022 4:56 pm

Are you using an index ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Help for scrollBar

Postby Silvio.Falconi » Mon Apr 18, 2022 5: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 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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help for scrollBar

Postby Silvio.Falconi » Wed Apr 20, 2022 9:39 am

Image

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: Select all  Expand view

@ 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: Select all  Expand view
RANGE 1,oDbf:OrdKeyCount()
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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help for scrollBar

Postby Silvio.Falconi » 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 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: 7052
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 106 guests