Page 1 of 1

scroll Horizontal button

PostPosted: Thu Feb 15, 2018 6:06 pm
by Silvio.Falconi
How scroll buttons on Horizontal ?
I think to scroll buttons from a dbf to use it on tablet
sample : I have many products and I wish scroll all images on horizontal and click on each
any test?

Re: scroll Horizontal button

PostPosted: Thu Feb 15, 2018 7:23 pm
by Antonio Linares
Please post a screenshot :-)

Re: scroll Horizontal button

PostPosted: Fri Feb 16, 2018 9:27 am
by Silvio.Falconi
I do not have an image to show you,
I need to create on tablet app buttons from an archive dbf with an animation that slide to the left and the new ones scroll from the right ...
the user can select one scrooling all archive them with your finger and click one on it (action)

I found now a image
Image

Re: scroll Horizontal button

PostPosted: Fri Feb 16, 2018 6:07 pm
by Silvio.Falconi
i made a test but I not Know How move the buttons Imagine to use a finger and move the buttons on right and left

Image



Code: Select all  Expand view

#INCLUDE "Fivewin.ch"
#INCLUDE "Ribbon.ch"
#include "constant.ch"

Function test()

   Local oDlg,oFld
   Local oFontTablet

 // variabili per la dialog
    Local  nBottom   := 13
    Local  nRight    := 78
    Local  nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
    Local  nHeight := nBottom * DLG_CHARPIX_H
    LOCAL nRow:= 10
    Local nCol:= 10
    Local n:= 1
    local nTipo:=0
    local abtn
    USE TIPO ALIAS TIPO
    TIPO->(DbGoTop())
    abtn:= array(tipo->(OrdKeyCount()))

    DEFINE FONT oFontTablet NAME "TAHOMA" SIZE 0,-25

DEFINE DIALOG oDlg  SIZE nWidth, nHeight;
            TITLE "Selezione prodotti";
            STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )

DO WHILE .not. TIPO->(EOF())

   @  nRow,nCol RBBTN abtn[n]   BITMAP ".\bitmaps\normale.png";
              SIZE 60,60  OF  oDlg   PIXEL PROMPT Right(tipo->desc,1);
            ACTION   ( abtn[n]:lSelected:=.t. ,nTipo:= n)  FONT oFontTablet


       TIPO->(DBSKIP())
   n++
    nCol+=65
   ENDDO
ACTIVATE DIALOG oDlg
return nil

 

Re: scroll Horizontal button

PostPosted: Fri Feb 16, 2018 6:20 pm
by Silvio.Falconi
Perhaps using TScrollPanel ?


Code: Select all  Expand view

#INCLUDE "Fivewin.ch"
#INCLUDE "Ribbon.ch"
#include "constant.ch"

Function test()

   Local oDlg,oFld
   Local oFontTablet

 // variabili per la dialog
    Local  nBottom   := 13
    Local  nRight    := 78
    Local  nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
    Local  nHeight := nBottom * DLG_CHARPIX_H

    Local oScrPanel



    DEFINE FONT oFontTablet NAME "TAHOMA" SIZE 0,-25

DEFINE DIALOG oDlg  SIZE nWidth, nHeight;
            TITLE "Selezione prodotti";
            STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )

   oScrPanel := TScrollPanel():New( 1, 1, 50, oDlg:nRight-100, oDlg )


 ACTIVATE DIALOG oDlg ;
          ON INIT Show_Record(oScrPanel,oFontTablet)

return nil
//--------------------------------------------------------------------

Function Show_Record(oScrPanel,oFontTablet)
    LOCAL nRow:= 10
    Local nCol:= 10
    Local n:= 1
    local nTipo:=0
    local abtn

   USE TIPO ALIAS TIPO
    TIPO->(DbGoTop())
    abtn:= array(tipo->(OrdKeyCount()))

    DO WHILE .not. TIPO->(EOF())

   @  nRow,nCol RBBTN abtn[n]   BITMAP ".\bitmaps\normale.png";
              SIZE 100,120  OF  oScrPanel   PIXEL PROMPT Right(tipo->desc,1);
            ACTION   ( abtn[n]:lSelected:=.t. ,nTipo:= n)  FONT oFontTablet


       TIPO->(DBSKIP())
   n++
    nCol+=120
 ENDDO

 RETURN NIL
 

Re: scroll Horizontal button

PostPosted: Sat Feb 17, 2018 11:15 am
by Silvio.Falconi
Antonio,

this is my last test
I use tscrollpanel
but I can only scroll on vertical
How scroll on Horizontal ?

it create the archive

Code: Select all  Expand view

#INCLUDE "Fivewin.ch"
#INCLUDE "Ribbon.ch"
#include "constant.ch"


REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO
#define CLR_DIALOGS RGB( 123, 140, 223 )

/*
  METHOD finger(x) CLASS TScrollPanel
    ::GoToPos( x )
return nil

*/




Function test()

   Local oDlg,oFld
   Local oFontTablet

 // variabili per la dialog
    Local  nBottom   := 13
    Local  nRight    := 78
    Local  nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
    Local  nHeight := nBottom * DLG_CHARPIX_H
    Local lSlider := .t.

    Local oScrPanel
    RddSetDefault( "DBFCDX" )

    Create_Test()


    DEFINE FONT oFontTablet NAME "TAHOMA" SIZE 0,-25

DEFINE DIALOG oDlg  SIZE nWidth, nHeight;
            TITLE "Selec Ticket";
            STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )

oScrPanel := TScrollPanel():New( 0, 0, 90, oDlg:nRight-100, oDlg,.t. )
oScrPanel:SetColor( CLR_WHITE, CLR_DIALOGS )

oScrPanel:bLClicked    := { || oScrPanel:SetFocus(),lSlider := .t. }
oScrPanel:bLButtonUp     := { |r,c,f,lDrag | lSlider := .f. }
oScrPanel:bMMoved  := { |r,c,f,lDrag| if( lSlider = .t. ,oScrPanel:finger(r), ) }

 ACTIVATE DIALOG oDlg ;
          ON INIT Show_Record(oScrPanel,oFontTablet)

return nil
//--------------------------------------------------------------------

Function Show_Record(oScrPanel,oFontTablet)
    LOCAL nRow:= 10
    Local nCol:= 10
    Local n:= 1
    local nTipo:=0
    local abtn

    USE TIPO ALIAS TIPO   NEW

    TIPO->(DbGoTop())
    abtn:= array(tipo->(OrdKeyCount()))

    DO WHILE .not. TIPO->(EOF())

   @  nRow,nCol RBBTN abtn[n]   BITMAP ".\bitmaps\normale.png";
              SIZE 100,120  OF  oScrPanel   PIXEL PROMPT lEFT(tipo->desc,8);
            ACTION   ( abtn[n]:lSelected:=.t. ,nTipo:= n)  FONT oFontTablet


       TIPO->(DBSKIP())
   n++
    nCol+=120
 ENDDO
   oScrPanel:SetRange()
 RETURN NIL
//----------------------------------------------------------------------------//
Function Create_Test()

     DbCreate('TI', {{ "CODICE"    , "C",     4,    0 },;
                     { "DESC"  , "C",     30,    0 } } , 'DBFCDX')


      close all
      use &('TI') new
      select TI
      if FILE('TIPO.DBF')
         delete file &('TIPO.cdx')
         append from &('TIPO')
         dbcommitall()
         close all
         delete file &('TIPO.dbf')
      endif
      close all
      rename &('TI.dbf') to &('TIPO.dbf')

   if File('tipo.CDX')
      delete file &('tipo.cdx')
   endif


    USE TIPO ALIAS TIPO   NEW

    IF TIPO->(EOF())
       For n=1 to 20
          TIPO->(DbAppend())
          Replace Tipo->Codice with strzero(tipo->(recno()),4)
          Replace Tipo->Desc with "BTN"+strzero(tipo->(recno()),4)
          TIPO->(DbCommit())
       Next n
    Endif

      INDEX ON (codice) TAG tipo01     FOR ! deleted()


      DbCloseAll()


   return nil