FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour UP, DOWN arrow keys pressed in xBrowse
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: UP, DOWN arrow keys pressed in xBrowse
Posted: Tue Nov 10, 2009 06: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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: UP, DOWN arrow keys pressed in xBrowse
Posted: Tue Nov 10, 2009 08:54 PM

Ok, great! :D

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: UP, DOWN arrow keys pressed in xBrowse
Posted: Tue Nov 10, 2009 08: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 (fw): Select all Collapse
CLASS MyBrowse FROM TXBrowse

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

ENDCLASS
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: UP, DOWN arrow keys pressed in xBrowse
Posted: Tue Nov 10, 2009 09: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! :-)

I did this to preserved my predefined xBrowse:

Code (fw): Select all Collapse
...
   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 (fw): Select all Collapse
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
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
Re: UP, DOWN arrow keys pressed in xBrowse
Posted: 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

Continue the discussion