How I must make it ?
I must create two panels one for each tabs ?
I made a test but not run ok and I see a black color into
thanks in advance
- Code: Select all Expand view RUN
- #include "FiveWin.ch"
#define LIGHTORANGE1 nRGB( 250, 227, 143 )
#define DARKCYAN nRGB( 125, 165, 224 )
static oScrWnd,otab,odlg
Function main()
Local oDlg
Local OTab
Local oPanel,oPanel1
Local nSplit := 50
Local oScrWnd
DEFINE DIALOG oDlg SIZE 800,600
oPanel:= TPanel():New(40,10,200,400,oDlg)
// oPanel:nClrPane := LIGHTORANGE1
//oPanel1:= TPanel():New(40,nSplit+5,oDlg:nBottom,oDlg:nwidth,oDlg)
@ oPanel:nBottom, 10 TABS oTab ;
SIZE oPanel:nWidth(), 12 PIXEL OF oDlg
oTab:aPrompts ={ "&One", "&Two", "T&hree" }
oTab:noption:=2
Activate Dialog oDlg ;
on init (oScrWnd:=TScrWnd():New( oPanel,1,40,1,70),test(otab))
return nil
Function test (otab)
if oTab:noption = 1
@ 10,1 say " panel & tab 1 " of otab
elseif oTab:noption = 2
@ 10,1 say " panel & tab 2 " of otab
ENDIF
RETURN NIL
#ifndef TRUE
#define TRUE .T.
#define FALSE .F.
#endif
#define D_WIDTH 4
#define D_HEIGHT 13
CLASS TScrWnd FROM TCONTROL
DATA oMAx
DATA nVPos,nHPos
METHOD New( oMAx,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( oMAx,nV1,nV2,nH1,nH2 ) CLASS TScrWnd
::nVPos := 0
::nHPos := 0
::oMAx := oMAx
DEFINE SCROLLBAR ::oMAx:oVScroll VERTICAL OF ::oMAx
DEFINE SCROLLBAR ::oMAx:oHScroll HORIZONTAL OF ::oMAx
::SetScroll( nV1,nV2,nH1,nH2 )
::oMAx:bMouseWheel = { | nKey, nDelta, nXPos, nYPos |If( nDelta < 0, ::oMAx:oVScroll:GoDown(), ::oMAx:oVScroll:GoUp() ) }
RETURN Self
METHOD SetScroll( nV1,nV2,nH1,nH2 ) CLASS TScrWnd
LOCAL aCoors1:={},aCoors2:={}
//--------------------------------------------------
//-* Vertical Scroll Bar
// ? ::oMAx:oVSCroll=NIL
if ::oMAx:oVScroll != NIL
// ? nV1,nV2
::oMAx:oVScroll:SetRange( nV1,nV2 )
::nVPos := ::oMAx:oVScroll:GetPos()
::oMAx:oVScroll:bGoDown := {|| ::VScroll() }
::oMAx:oVScroll:bGoUp := {|| ::VScroll() }
::oMAx:oVScroll:bPageUp := {|| ::VScrollPgUp() }
::oMAx:oVScroll:bPageDown := {|| ::VScrollPgDown() }
::oMAx:oVScroll:bGoTop := {|| ::VScroll() }
::oMAx:oVScroll:bGoBottom := {|| ::VScroll() }
::oMAx:oVScroll:nPgStep := 10
//::oMAx:oVScroll:lReDraw := TRUE
::oMAx:oVScroll:bPos := {|nPos| ::VScrollThumb(nPos) }
::oMAx:oVScroll:bTrack := {|nPos| ::VScrollTrack(nPos) }
endif
//--------------------------------------------------
//-* Horizontal Scroll Bar
if ::oMAx:oHScroll != NIL
::oMAx:oHScroll:SetRange( nH1,nH2 )
::nHPos := ::oMAx:oHScroll:GetPos()
::oMAx:oHScroll:bGoDown := {|| ::HScroll() }
::oMAx:oHScroll:bGoUp := {|| ::HScroll() }
::oMAx:oHScroll:bPageUp := {|| ::HScrollPgUp() }
::oMAx:oHScroll:bPageDown := {|| ::HScrollPgDown() }
::oMAx:oHScroll:bGoTop := {|| ::HScroll() }
::oMAx:oHScroll:bGoBottom := {|| ::HScroll() }
::oMAx:oHScroll:nPgStep := 10
//::oMAx:oHScroll:lReDraw := TRUE
::oMAx:oHScroll:bPos := {|nPos| ::HScrollThumb(nPos) }
::oMAx:oHScroll:bTrack := {|nPos| ::HScrollTrack(nPos) }
endif
//::oMAx: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 TScrWnd
LOCAL nNewPos
if ::nVPos >= ::oMAx:oVScroll:nMin ;
.and. ::nVPos <= ::oMAx:oVScroll:nMax
nNewPos := ::oMAx:oVScroll:GetPos()
SysRefresh()
ScrollWindow( ::oMAx:hWnd, 0, ;
( ::nVPos-nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oMAx:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
METHOD VScrollThumb(nNewPos) CLASS TScrWnd
if ::nVPos >= ::oMAx:oVScroll:nMin ;
.and. ::nVPos <= ::oMAx:oVScroll:nMax
::oMAx:oVScroll:SetPos(nNewPos)
SysRefresh()
ScrollWindow( ::oMAx:hWnd, 0, ;
(::nVPos - nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oMAx:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
METHOD VScrollTrack(nNewPos) CLASS TScrWnd
if ::nVPos >= ::oMAx:oVScroll:nMin ;
.and. ::nVPos <= ::oMAx:oVScroll:nMax
::oMAx:oVScroll:SetPos(nNewPos)
SysRefresh()
ScrollWindow( ::oMAx:hWnd, 0, ;
(::nVPos - nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oMAx:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
METHOD VScrollPgDown() CLASS TScrWnd
LOCAL nNewPos
if ::nVPos < ::oMAx:oVScroll:nMax
nNewPos := ::nVPos + ::oMAx:oVScroll:nPgStep
nNewPos := iif(nNewPos > ::oMAx:oVScroll:nMax, ::oMAx:oVScroll:nMax, nNewPos)
SysRefresh()
ScrollWindow( ::oMAx:hWnd, 0, ;
( ::nVPos - nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oMAx:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
METHOD VScrollPgUp() CLASS TScrWnd
LOCAL nNewPos
if ::nVPos > ::oMAx:oVScroll:nMin
nNewPos := ::nVPos - ::oMAx:oVScroll:nPgStep
nNewPos := iif(nNewPos < ::oMAx:oVScroll:nMin,::oMAx:oVScroll:nMin,nNewPos)
SysRefresh()
ScrollWindow( ::oMAx:hWnd, 0, ;
( ::nVPos - nNewPos )*D_HEIGHT, ;
0 , GetClientRect(::oMAx:hWnd) )
::nVPos := nNewPos
endif
RETURN( NIL )
//=================================================================
//-* Horizontal Scroll Bar
METHOD HScroll() CLASS TScrWnd
LOCAL nNewPos
if ::nHPos >= ::oMAx:oHScroll:nMin ;
.and. ::nHPos <= ::oMAx:oHScroll:nMax
nNewPos := ::oMAx:oHScroll:GetPos()
SysRefresh()
ScrollWindow( ::oMAx:hWnd, ;
(::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oMAx:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )
METHOD HScrollThumb(nNewPos) CLASS TScrWnd
if ::nHPos >= ::oMAx:oHScroll:nMin ;
.and. ::nHPos <= ::oMAx:oHScroll:nMax
::oMAx:oHScroll:SetPos(nNewPos)
SysRefresh()
ScrollWindow( ::oMAx:hWnd, ;
(::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oMAx:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )
METHOD HScrollTrack(nNewPos) CLASS TScrWnd
if ::nHPos >= ::oMAx:oHScroll:nMin ;
.and. ::nHPos <= ::oMAx:oHScroll:nMax
::oMAx:oHScroll:SetPos(nNewPos)
SysRefresh()
ScrollWindow( ::oMAx:hWnd, ;
(::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oMAx:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )
METHOD HScrollPgDown() CLASS TScrWnd
LOCAL nNewPos
if ::nHPos < ::oMAx:oHScroll:nMax
nNewPos := ::nHPos + ::oMAx:oHScroll:nPgStep
nNewPos := iif(nNewPos > ::oMAx:oHScroll:nMax, ::oMAx:oHScroll:nMax, nNewPos)
SysRefresh()
ScrollWindow( ::oMAx:hWnd, ;
( ::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oMAx:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )
METHOD HScrollPgUp() CLASS TScrWnd
LOCAL nNewPos
if ::nHPos > ::oMAx:oHScroll:nMin
nNewPos := ::nHPos - ::oMAx:oHScroll:nPgStep
nNewPos := iif(nNewPos < ::oMAx:oHScroll:nMin,::oMAx:oHScroll:nMin,nNewPos)
SysRefresh()
ScrollWindow( ::oMAx:hWnd, ;
( ::nHPos - nNewPos )*D_WIDTH,0, ;
0 , GetClientRect(::oMAx:hWnd) )
::nHPos := nNewPos
endif
RETURN( NIL )