I tried to compile fwh app and it run ok and it is too fast from my portable computer asus rog
now I must create a mode tablet application
i tried to make a scroll dialog to use it with tablet mode but it not run ok and i not understood how make it
I use a class to scrool the dialog get but it run only if there is the mouse
i not understood why on tablet mode it not run it show the dialog but then i cannot scroll the dialog
do you have a sample test to show get on mode tablet ?I tried the test win10.prg and it run ok but I not understood how imlement it on my dialogs
I make a test but it not run on mode tablet
- Code: Select all Expand view
// //search on rc file the dialog
//
#include "FiveWin.ch"
#define D_WIDTH 4
#define D_HEIGHT 13
#ifndef TRUE
#define TRUE .T.
#define FALSE .F.
#endif
FUNCTION Main()
LOCAL oDlg, oScrDlg
Local nRow:= 10
Local nCol := 10
Local nCol2:= 95
Local aGet:= array(30)
local cget:= space(20)
local oFontTablet
DEFINE FONT oFontTablet NAME "TAHOMA" SIZE 0,-25
DEFINE DIALOG oDlg ;
TITLE "Scroll dialog test for Otto" ;
STYLE nOR( WS_VSCROLL, WS_HSCROLL ) ;
FONT oFontTablet
For n= 1 to 30
@ nRow, nCol SAY "test"+str(n) SIZE 75,18 OF oDlg PIXEL FONT oFontTablet
@ nRow, nCol2 GET aGet[n] VAR cget SIZE 250,18 OF oDlg PIXEL FONT oFontTablet
nRow+=26
next
@ nRow+20, nCol+130 button "&Conferma" SIZE 75,18 OF oDlg PIXEL FONT oFontTablet
@ nRow+20, nCol+250 button "&Annulla" SIZE 75,18 OF oDlg PIXEL FONT oFontTablet
oDlg:bMouseWheel = { | nKey, nDelta, nXPos, nYPos | MouseWheel( nKey, nDelta, nXPos, nYPos, oScrDlg ) }
ACTIVATE DIALOG oDlg ;
ON INIT ( oScrDlg := TScrDlg():New( oDlg, 1, 95, 1, 2), oDlg:SetSize( 740, 500 ), oDlg:Center() )
RETURN( NIL )
//-----------------------------------------------------------------------------//
function MouseWheel( nKey, nDelta, nXPos, nYPos, oScrDlg )
local oVScroll := oScrDlg:oDlg:oVScroll
if nDelta < 0
oVScroll:GoDown()
else
oVScroll:GoUp()
endif
oScrDlg:VScroll()
return nil
//-----------------------------------------------------------------------------//
CLASS TScrDlg
DATA oDlg
DATA nVPos, nHPos
METHOD New( oDlg,nV1,nV2,nH1,nH2 ) CONSTRUCTOR
METHOD SetScroll( nV1,nV2,nH1,nH2 )
//-*------------------------------------------------------------
METHOD VScroll()
METHOD VScrollThumb()
METHOD VScrollTrack()
METHOD VScrollPgDown()
METHOD VScrollPgUp()
//-*-----------------------------
METHOD HScroll()
METHOD HScrollThumb()
METHOD HScrollTrack()
METHOD HScrollPgDown()
METHOD HScrollPgUp()
ENDCLASS
METHOD New( oDlg,nV1,nV2,nH1,nH2 ) CLASS TScrDlg
::nVPos := 0
::nHPos := 0
::oDlg := oDlg
::SetScroll( nV1,nV2,nH1,nH2 )
RETURN Self
METHOD SetScroll( nV1,nV2,nH1,nH2 ) CLASS TScrDlg
LOCAL aCoors1:={},aCoors2:={}
//--------------------------------------------------
//-* Vertical Scroll Bar
if ::oDlg:oVScroll != NIL
::oDlg:oVScroll:SetRange( nV1,nV2 )
::nVPos := ::oDlg:oVScroll:GetPos()
::oDlg:oVScroll:bGoDown := {|| ::VScroll() }
::oDlg:oVScroll:bGoUp := {|| ::VScroll() }
::oDlg:oVScroll:bPageUp := {|| ::VScrollPgUp() }
::oDlg:oVScroll:bPageDown := {|| ::VScrollPgDown() }
::oDlg:oVScroll:bGoTop := {|| ::VScroll() }
::oDlg:oVScroll:bGoBottom := {|| ::VScroll() }
::oDlg:oVScroll:nPgStep := 10
//::oDlg:oVScroll:lReDraw := TRUE
::oDlg:oVScroll:bPos := {|nPos| ::VScrollThumb(nPos) }
::oDlg:oVScroll:bTrack := {|nPos| ::VScrollTrack(nPos) }
endif
//--------------------------------------------------
//-* Horizontal Scroll Bar
if ::oDlg:oHScroll != NIL
::oDlg:oHScroll:SetRange( nH1,nH2 )
::nHPos := ::oDlg:oHScroll:GetPos()
::oDlg:oHScroll:bGoDown := {|| ::HScroll() }
::oDlg:oHScroll:bGoUp := {|| ::HScroll() }
::oDlg:oHScroll:bPageUp := {|| ::HScrollPgUp() }
::oDlg:oHScroll:bPageDown := {|| ::HScrollPgDown() }
::oDlg:oHScroll:bGoTop := {|| ::HScroll() }
::oDlg:oHScroll:bGoBottom := {|| ::HScroll() }
::oDlg:oHScroll:nPgStep := 10
//::oDlg:oHScroll:lReDraw := TRUE
::oDlg:oHScroll:bPos := {|nPos| ::HScrollThumb(nPos) }
::oDlg:oHScroll:bTrack := {|nPos| ::HScrollTrack(nPos) }
endif
* ::oDlg:bKeyChar := {|nKey,nFlags| ScrollKey(nKey) }
//--------------------------------------------------
RETURN( NIL )
/*
STATIC FUNCTION ScrollKey(nKey)
MsgInfo( "Key : "+str(nKey,10) )
//if nKey == K_ENTER
// goMainDlg:End()
// lRetVal := TRUE
//endif
RETURN( NIL )
*/
//=================================================================
//-* Vertical Scroll Bar
METHOD VScroll() CLASS TScrDlg
LOCAL nNewPos
if ::nVPos >= ::oDlg:oVScroll:nMin ;
.and. ::nVPos <= ::oDlg:oVScroll:nMax
nNewPos := ::oDlg:oVScroll:GetPos()
SysRefresh()
ScrollWindow( ::oDlg:hWnd, 0, ;
( ::nVPos-nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oDlg:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
METHOD VScrollThumb(nNewPos) CLASS TScrDlg
if ::nVPos >= ::oDlg:oVScroll:nMin ;
.and. ::nVPos <= ::oDlg:oVScroll:nMax
::oDlg:oVScroll:SetPos(nNewPos)
SysRefresh()
ScrollWindow( ::oDlg:hWnd, 0, ;
(::nVPos - nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oDlg:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
METHOD VScrollTrack(nNewPos) CLASS TScrDlg
if ::nVPos >= ::oDlg:oVScroll:nMin ;
.and. ::nVPos <= ::oDlg:oVScroll:nMax
::oDlg:oVScroll:SetPos(nNewPos)
SysRefresh()
ScrollWindow( ::oDlg:hWnd, 0, ;
(::nVPos - nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oDlg:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
METHOD VScrollPgDown() CLASS TScrDlg
LOCAL nNewPos
if ::nVPos < ::oDlg:oVScroll:nMax
nNewPos := ::nVPos + ::oDlg:oVScroll:nPgStep
nNewPos := iif(nNewPos > ::oDlg:oVScroll:nMax, ::oDlg:oVScroll:nMax, nNewPos)
SysRefresh()
ScrollWindow( ::oDlg:hWnd, 0, ;
( ::nVPos - nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oDlg:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
METHOD VScrollPgUp() CLASS TScrDlg
LOCAL nNewPos
if ::nVPos > ::oDlg:oVScroll:nMin
nNewPos := ::nVPos - ::oDlg:oVScroll:nPgStep
nNewPos := iif(nNewPos < ::oDlg:oVScroll:nMin,::oDlg:oVScroll:nMin,nNewPos)
SysRefresh()
ScrollWindow( ::oDlg:hWnd, 0, ;
( ::nVPos - nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oDlg:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
//=================================================================
//-* Horizontal Scroll Bar
METHOD HScroll() CLASS TScrDlg
LOCAL nNewPos
if ::nHPos >= ::oDlg:oHScroll:nMin ;
.and. ::nHPos <= ::oDlg:oHScroll:nMax
nNewPos := ::oDlg:oHScroll:GetPos()
SysRefresh()
ScrollWindow( ::oDlg:hWnd, ;
(::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oDlg:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )
METHOD HScrollThumb(nNewPos) CLASS TScrDlg
if ::nHPos >= ::oDlg:oHScroll:nMin ;
.and. ::nHPos <= ::oDlg:oHScroll:nMax
::oDlg:oHScroll:SetPos(nNewPos)
SysRefresh()
ScrollWindow( ::oDlg:hWnd, ;
(::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oDlg:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )
METHOD HScrollTrack(nNewPos) CLASS TScrDlg
if ::nHPos >= ::oDlg:oHScroll:nMin ;
.and. ::nHPos <= ::oDlg:oHScroll:nMax
::oDlg:oHScroll:SetPos(nNewPos)
SysRefresh()
ScrollWindow( ::oDlg:hWnd, ;
(::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oDlg:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )
METHOD HScrollPgDown() CLASS TScrDlg
LOCAL nNewPos
if ::nHPos < ::oDlg:oHScroll:nMax
nNewPos := ::nHPos + ::oDlg:oHScroll:nPgStep
nNewPos := iif(nNewPos > ::oDlg:oHScroll:nMax, ::oDlg:oHScroll:nMax, nNewPos)
SysRefresh()
ScrollWindow( ::oDlg:hWnd, ;
( ::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oDlg:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )
METHOD HScrollPgUp() CLASS TScrDlg
LOCAL nNewPos
if ::nHPos > ::oDlg:oHScroll:nMin
nNewPos := ::nHPos - ::oDlg:oHScroll:nPgStep
nNewPos := iif(nNewPos < ::oDlg:oHScroll:nMin,::oDlg:oHScroll:nMin,nNewPos)
SysRefresh()
ScrollWindow( ::oDlg:hWnd, ;
( ::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oDlg:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )
//=* End of File =================================================