UP, DOWN arrow keys pressed in xBrowse

Re: UP, DOWN arrow keys pressed in xBrowse

Postby nageswaragunupudi » Tue Nov 10, 2009 6:35 pm

1) database.prg
The reference is "oWnd:IsKindOf( TXBrowse() )".
This applies to all classes derived from TXBrowse.

2) btnbmp.prg
The reference applies only when lBorder is .t.. Since XBrowse creates btnbmps with NOBORDER clause this reference has no effect.

3) Dialog.Prg
If the dialog is Transparent all its controls are also made transparent if the control is not in a list, which includes TXBrowse. As a result, the only behavioral difference between using TXBrowse directly or using a child browse is that :
(a) If the dialog is transparent, and the control is txbrowse, the browses ltransparent is not automatically set to .t.. It still remains .f. unless browse itself internally sets it to .t.
(b) If a derived class is used and if the Dialog is Transparent, the browse's lTransparent is also automatially set to .t. This is the only difference and does not have much effect on the performance. This is the only issue that needs to be taken care of, though not very important.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Re: UP, DOWN arrow keys pressed in xBrowse

Postby nageswaragunupudi » Tue Nov 10, 2009 8:59 pm

nageswaragunupudi wrote:3) Dialog.Prg
If the dialog is Transparent all its controls are also made transparent if the control is not in a list, which includes TXBrowse. As a result, the only behavioral difference between using TXBrowse directly or using a child browse is that :
(a) If the dialog is transparent, and the control is txbrowse, the browses ltransparent is not automatically set to .t.. It still remains .f. unless browse itself internally sets it to .t.
(b) If a derived class is used and if the Dialog is Transparent, the browse's lTransparent is also automatially set to .t. This is the only difference and does not have much effect on the performance. This is the only issue that needs to be taken care of, though not very important.


For the time being, the work around for this ( if the programmer considers this to be really important ) is to have a an inline method inside the derived class. Example:
Code: Select all  Expand view
CLASS MyBrowse FROM TXBrowse

   METHOD Initiate( hDlg ) INLINE ( ::lTransparent := .f., Super:Initiate( hDlg ) )

ENDCLASS
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: UP, DOWN arrow keys pressed in xBrowse

Postby nageswaragunupudi » Tue Nov 10, 2009 9:35 pm

fraxzi wrote:
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




Thank you so much for the great idea! :wink:

I did this to preserved my predefined xBrowse:

Code: Select all  Expand view

...
   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!


Very Important:
You should have this CLASSDATA lRegisterd AS LOGICAL in the derived class
Code: Select all  Expand view
CLASS MyxBrowse from TXBrowse
   CLASSDATA lRegistered AS LOGICAL
   METHOD KeyDown( nKey, nFlags )
ENDCLASS
 

This line is essential in all derived controls
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: UP, DOWN arrow keys pressed in xBrowse

Postby fraxzi » Wed Nov 11, 2009 12:53 am

Thanks Rao for the additional input.


My best 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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 109 guests

cron