UP, DOWN arrow keys pressed in xBrowse
UP, DOWN arrow keys pressed in xBrowse
Hello All,
I use bKeyDown and bKeyChar but I cant trap the UP and DOWN arrow keys..
No problem If using mouse to navigate but if UP,DOWN keys are pressed?
Regards,
Fraxzi
I use bKeyDown and bKeyChar but I cant trap the UP and DOWN arrow keys..
No problem If using mouse to navigate but if UP,DOWN keys are pressed?
Regards,
Fraxzi
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Re: UP, DOWN arrow keys pressed in xBrowse
Fraxzi,
modifying the METHOD KeyDown() in xbrowse.prg works for me. For example I wanted to trap the key VK_TAB:
modifying the METHOD KeyDown() in xbrowse.prg works for me. For example I wanted to trap the key VK_TAB:
Code: Select all
CASE nKey == VK_TAB
My_Tab()
Re: UP, DOWN arrow keys pressed in xBrowse
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
CASE nKey == VK_TAB My_Tab()
Thanks Frose!
as-much-as possible not to modify the original class so I wont forget the modification after an upgrade...
That would be the last resort.
Regards,
Fraxzi
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: UP, DOWN arrow keys pressed in xBrowse
Fraxzi,
You will have to subclass xbrowse and create a new keyDown() method.
James
You will have to subclass xbrowse and create a new keyDown() method.
James
Re: UP, DOWN arrow keys pressed in xBrowse
Thanks James,
Do you have a sample I can start with?
Fraxzi
Do you have a sample I can start with?
Fraxzi
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: UP, DOWN arrow keys pressed in xBrowse
Code: Select all
#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 )
Re: UP, DOWN arrow keys pressed in xBrowse
James Bott wrote:Code: Select all
#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 )
Hello James,
Thank you for the reply.
with the above, can I alter the Method Keydown() on an already created object TXBrowse?
Regards,
Fraxzi
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: UP, DOWN arrow keys pressed in xBrowse
Fraxzi,
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
Well, you have to use MyBrowse instead of TXBrowse, but other than the way you call it:with the above, can I alter the Method Keydown() on an already created object TXBrowse?
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
Re: UP, DOWN arrow keys pressed in xBrowse
James,
thank you very much for this tip, how to use inheritance and subtyping, polymorphism or overriding. How easy OOP can be
thank you very much for this tip, how to use inheritance and subtyping, polymorphism or overriding. How easy OOP can be
Re: UP, DOWN arrow keys pressed in xBrowse
James Bott wrote:Fraxzi,
Well, you have to use MyBrowse instead of TXBrowse, but other than the way you call it:with the above, can I alter the Method Keydown() on an already created object TXBrowse?
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
Thank you so much for the great idea!
I did this to preserved my predefined xBrowse:
Code: Select all
...
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 )
...
It works like magic! I wouldn't discover this without your input.
Thanks so much!
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: UP, DOWN arrow keys pressed in xBrowse
Unfortunately the name of the original class is used inside various FWH sources and this prevents the full working inheritance.
EMG
EMG
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: UP, DOWN arrow keys pressed in xBrowse
I think this is not correct. XBrowse is intentionally coded to enable use of Inherited classes.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
If we use the the statement
Code: Select all
SET XBROWSE TO MyBrowse()
Code: Select all
SetXBrowse( { || MyBrowse() }
What is hardcoded is TXBrows() not TXBrowse(). TXBrows() by default returns TXBrowse() and when SetXBrowse( ... ) is executed, TXBrows() returns the new class not the parent TXBrowse() class.
After executing the above statement, all commands work with the MyBrowse() instead of TXBrowse()
But I noticed some bugs if we change different child classes within the same program. From my experience I advise using SET XBROWSE TO command at the beginning of the program.
Using the clause CLASS for each browse is supposed to use the child class only for that browse, but I faced some problems in its working.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: UP, DOWN arrow keys pressed in xBrowse
Please search for the string "txbrowse" inside FWH source code.
EMG
EMG
Re: UP, DOWN arrow keys pressed in xBrowse
Out of 105 references, 102 reference are in xBrowse.Prg itself and 1 reference in btnbmp.prg, 1 in database.prg and 1 in Dialog.prgPlease search for the string "txbrowse" inside FWH source code.
Regards
Anser
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: UP, DOWN arrow keys pressed in xBrowse
Exactly. The problem are the ones in btnbmp.prg, database.prg and dialog.prg.
EMG
EMG