#include "fivewin.ch"
procedure main()
...
OverrideAndExtend()
...
define window ...
...
activate window ...
return
/*-------------------------------------------------------------------------------------------------*/
PROCEDURE OverrideAndExtend()
EXTEND CLASS TFOLDER WITH METHOD RefreshPages
EXTEND CLASS TFOLDER WITH METHOD GoFirstControl
EXTEND CLASS TDIALOG WITH METHOD RefreshDialog
RETURN
/*-------------------------------------------------------------------------------------------------*/
STATIC FUNCTION RefreshDialog( nPos )
LOCAL SELF := HB_QSelf()
DEFAULT nPos := 0
AEval( ::aControls, { | oCtrl | oCtrl:Refresh() } )
IF nPos > 0 .AND. Len( ::aControls ) > 0
::aControls[ nPos ]:SetFocus()
ENDIF
RETURN NIL
/*-------------------------------------------------------------------------------------------------*/
STATIC FUNCTION RefreshPages()
LOCAL SELF := HB_QSelf()
LOCAL oPage
FOR EACH oPage IN ::aDialogs
AEval( oPage:aControls, { | oCtrl | oCtrl:Refresh() } )
NEXT
RETURN NIL
/*-------------------------------------------------------------------------------------------------*/
STATIC FUNCTION GoFirstControl()
LOCAL SELF := HB_QSelf()
::aDialogs[ 1 ]:aControls[ 1 ]:SetFocus()
RETURN NIL
/*-------------------------------------------------------------------------------------------------*/
#include "fivewin.ch"
PROCEDURE main()
...
OverrideAndExtend()
...
redefine folder oFolder ...
...
redefine listbox oBrw ...
oBrw:oFolder := oFolder
...
RETURN
/*---------------------------------------------------------------------------*/
#include "vkey.ch"
PROCEDURE OverrideAndExtend()
/*new data and method*/
EXTEND CLASS TWBROWSE WITH DATA oFolder
EXTEND CLASS TWBROWSE WITH METHOD NextPageOnFolder
EXTEND CLASS TWBROWSE WITH METHOD PrevPageOnFolder
/*change method*/
OVERRIDE METHOD KeyDown CLASS TWBROWSE WITH METHOD MyKeyDown
RETURN
/*---------------------------------------------------------------------------*/
STATIC FUNCTION NextPageOnFolder()
LOCAL SELF := HB_QSelf()
LOCAL nCountPage := len( ::oFolder:aDialogs )
//TODO: Make code correct :-)
::oFolder:SetOption(1)
RETURN NIL
/*---------------------------------------------------------------------------*/
STATIC FUNCTION PrevPageOnFolder()
LOCAL SELF := HB_QSelf()
LOCAL nCountPage := len( ::oFolder:aDialogs )
//TODO: Make code correct :-)
::oFolder:SetOption(2)
RETURN NIL
/*---------------------------------------------------------------------------*/
STATIC FUNCTION MyKeyDown( nKey, nFlags )
LOCAL SELF := HB_QSelf()
DO CASE
CASE nKey == VK_UP
::GoUp()
CASE nKey == VK_DOWN
::GoDown()
CASE nKey == VK_LEFT //modify
IF ::oFolder=NIL
::GoLeft()
ELSE
::PrevPageOnFolder()
ENDIF
CASE nKey == VK_RIGHT //modify
IF ::oFolder=NIL
::GoRight()
ELSE
::NextPageOnFolder()
ENDIF
CASE nKey == VK_HOME
::GoTop()
CASE nKey == VK_END
::GoBottom()
CASE nKey == VK_PRIOR
IF GetKeyState( VK_CONTROL )
::GoTop()
ELSE
::PageUp()
ENDIF
CASE nKey == VK_NEXT
IF GetKeyState( VK_CONTROL )
::GoBottom()
ELSE
::PageDown()
ENDIF
OTHEWISE
RETURN Super:KeyDown( nKey, nFlags )
ENDCASE
RETURN 0
/*---------------------------------------------------------------------------*/
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], nageswaragunupudi and 93 guests