CASE nKey == VK_TAB
My_Tab()
frose wrote:Fraxzi,
modifying the METHOD KeyDown() in xbrowse.prg works for me. For example I wanted to trap the key VK_TAB:
- Code: Select all Expand view
CASE nKey == VK_TAB
My_Tab()
#include "fivewin.ch"
#include "vkey.ch"
CLASS MyBrowse from TXBrowse
method KeyDown()
endclass
Method KeyDown( nKey, nFlags ) CLASS MyBrowse
do case
case nKey == VK_UP
// do whatever
case nKey == VK_DOWN
// do whatever
enddo
return super:keyDown( nKey, nFlags )
James Bott wrote:
- Code: Select all Expand view
#include "fivewin.ch"
#include "vkey.ch"
CLASS MyBrowse from TXBrowse
method KeyDown()
endclass
Method KeyDown( nKey, nFlags ) CLASS MyBrowse
do case
case nKey == VK_UP
// do whatever
case nKey == VK_DOWN
// do whatever
enddo
return super:keyDown( nKey, nFlags )
with the above, can I alter the Method Keydown() on an already created object TXBrowse?
James Bott wrote:Fraxzi,with the above, can I alter the Method Keydown() on an already created object TXBrowse?
Well, you have to use MyBrowse instead of TXBrowse, but other than the way you call it:
Instead of:
oBrw:= TXBrowse():new( oWnd )
You use:
oBrw:= MyBrowse():new( oWnd )
The syntax is exactly the same as TXBrowse (because everything else is TXBrowse code). So the only code you need to change is the above line.
You may want to read the Introduction to Object Oriented Programming articles on my website for a better understanding of OOP and subclassing.
http://www.gointellitech.com/program.htm
Regards,
James
...
REDEFINE XBROWSE oBrw ID 1023 OF oDlg;
AUTOSORT UPDATE AUTOCOLS FASTEDIT LINES CELL;
ARRAY { {'Test'} };
CLASS MyxBrowse()
...
CLASS MyxBrowse from TXBrowse
METHOD KeyDown( nKey, nFlags )
ENDCLASS
METHOD KeyDown( nKey, nFlags ) CLASS MyxBrowse
DO CASE
CASE nKey == VK_UP
// do whatever
msginfo( 'Up Key' test )
CASE nKey == VK_DOWN
// do whatever
ENDCASE
RETURN Super:KeyDown( nKey, nFlags )
...
Enrico Maria Giordano wrote:Unfortunately the name of the original class is used inside various FWH sources and this prevents the full working inheritance.
EMG
SET XBROWSE TO MyBrowse()
SetXBrowse( { || MyBrowse() }
Please search for the string "txbrowse" inside FWH source code.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 108 guests