XBROWSE determine FOOTER coordinates

XBROWSE determine FOOTER coordinates

Postby avista » Wed Aug 14, 2013 2:07 pm

Hi to all

How to determine coordinates of the FOOTER for some column nTop, nLeft, nBottom, nRight
For example
I need on oBrw:bKEyDown if nKey == VK_F2 and
if oBrw:nAt() ==2 or oBrw:nAt() == 3 to create a GET object on the same place (on the FOOTER of that column) with the same size
Or some other solution please

Best regardds,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: XBROWSE determine FOOTER coordinates

Postby nageswaragunupudi » Thu Aug 15, 2013 4:40 am

top: oBrw:BrwHeight() - oBrw:nFooterHeight + 3
left: oCol:nDisplayPos
bottom: oBrw:BrwHeight()
right: oCol:nDisplayPos + oCol:nWidth
Regards

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

Re: XBROWSE determine FOOTER coordinates

Postby avista » Fri Aug 16, 2013 11:16 am

Hi Rao
Thanks for reply
Please look this error:

Error description: Warning BASE/1004 Message not found: TXBRWCOLUMN:NDISPLAYPOS

Stack Calls
===========
Called from: source\rtl\tobject.prg => TXBRWCOLUMN:ERROR( 0 )
Called from: source\rtl\tobject.prg => TXBRWCOLUMN:MSGNOTFOUND( 0 )
Called from: source\rtl\tobject.prg => TXBRWCOLUMN:NDISPLAYPOS( 0 )
Called from: .\procedur.PRG => F_OK_CITAJ( 1867 )

If you think oCol:nDisplayCol ... i have returned value and tested
But problem is that created GET is always on the same place on screen whatever dialog or window where xbrowse is placed is moved

I need to do something like this

Code: Select all  Expand view  RUN

//----------------------------------------------------------------------------//

FUNCTION F_OK_CITAJ( nKey, oBrw )

local nBrPole := oBrw:nAt()
local oCol    := oBrw:aCols[ nBrPole ]

*local nTop    := oBrw:BrwHeight() - oBrw:nFooterHeight + 3
*local nLeft   := oCol:nDisplayPos
*local nBottom := oBrw:BrwHeight()
*local nRight  := oCol:nDisplayPos + oCol:nWidth

local nTop    := oBrw:BrwHeight() - oBrw:nFooterHeight + 3
local nLeft   := oCol:nDisplayCol
local nBottom := oBrw:BrwHeight()
local nRight  := oCol:nDisplayCol + oCol:nWidth

LOCAL oDlg, oGet
LOCAL cCitaj    := SPACE(50)

IF nKey > 31 .OR. nKey == 13

   DEFINE DIALOG oDlg OF oBrw:oWnd ;
          // need here coordinates of footer for taht column nevermind where is dialog with xBrowse placed
          FROM nTop, nLeft TO nBottom, nRight ;
          STYLE nOR( WS_VISIBLE, WS_POPUP ) ;
          PIXEL

   @   0,  0 GET oGet VAR cCitaj OF oDlg SIZE 100, 12 ; // ?? need same size as created dialog
             PIXEL ;
             FONT oFont1 ;
             VALID oDlg:End()

  oDlg:bStart := {|| oGet:KeyChar( nKey ) }  

  ACTIVATE DIALOG oDlg

ENDIF

RETURN ALLTRIM( cCitaj )
 


Probably need some combination with oBrw:oCol:DataRect() or GetClientRect() or GetWndRect() ... or some other solution

Or Can i use something like this ?
DEFINE DIALOG oDlg OF oCol:oFooter .... ????

I will be verry grateful for some sample

Best Best regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: XBROWSE determine FOOTER coordinates

Postby avista » Sat Aug 17, 2013 10:24 am

? Someone please

regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: XBROWSE determine FOOTER coordinates

Postby nageswaragunupudi » Sat Aug 17, 2013 10:12 pm

You are right. It is oCol:nDisplayCol not nDisplayPos. Sorry for my mistake,

These coordinates are relative to oBrw:hWnd. You need to derive coordinates relative to the screen for use to create a dialog. You may consider using the function ClientToScreen(...).
Regards

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

Re: XBROWSE determine FOOTER coordinates

Postby nageswaragunupudi » Sat Aug 17, 2013 10:21 pm

Instead of this code
Code: Select all  Expand view  RUN
local nBrPole := oBrw:nAt()
local oCol    := oBrw:aCols[ nBrPole ]
 

we can use
Code: Select all  Expand view  RUN
oCol := oBrw:SelectedCol()


Unlike other browses, when using XBrowse, let us not deal with column numbers but only with column objects. Nth column at the time of creation may not be nth column at run-time.

There are many built-in features of xbrowse like incremental searches, filters, wild-seeks/filters which can be invoked just by setting some switches instead of writing code, just like we do not have to write any code for inline edits.

Please consider if you can use any of these features before planning to write your special code.

May we also know the purpose of creating the dialog and get?
Regards

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

Re: XBROWSE determine FOOTER coordinates

Postby nageswaragunupudi » Sat Aug 17, 2013 10:45 pm

This is a sample function to create a dialog to fit over the footer
Code: Select all  Expand view  RUN
static function FooterDlg( oBrw )

   local oDlg, oCol, nTop, nLeft, nHeight, nWidth, aPoint, oGet
   local c := space(20)

   oCol     := oBrw:SelectedCol()
   nHeight  := oBrw:nFooterHeight - 3
   nWidth   := oCol:nWidth
   nTop     := oBrw:BrwHeight() - nHeight
   nLeft    := oCol:nDisplayCol
   aPoint   := ClientToScreen( oBrw:hWnd, { nTop, nLeft } )
   if aPoint[ 1 ] > 0x8000
      aPoint[ 1 ] -= 0xFFFF
   endif
   if aPoint[ 2 ] > 0x8000
      aPoint[ 2 ] -= 0xFFFF
   endif

   DEFINE DIALOG oDlg SIZE nWidth, nHeight PIXEL STYLE (WS_VISIBLE+WS_POPUP)
   @ 0,0 GET oGet VAR c SIZE nWidth/2,nHeight/2 PIXEL OF oDlg
   @ 1000,1000 BUTTON "" SIZE 10,10 PIXEL OF oDlg DEFAULT ACTION oDlg:End()
   ACTIVATE DIALOG oDlg ON INIT ( oDlg:Move( aPoint[ 1 ], aPoint[ 2 ] ) )

   msginfo( c )

return c

 
Regards

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

Re: XBROWSE determine FOOTER coordinates

Postby avista » Sun Aug 18, 2013 3:24 pm

Rao,

MANY Many thanks ... this is good function just i needd ..

There are many built-in features of xbrowse like incremental searches, filters, wild-seeks/filters which can be invoked just by setting some switches instead of writing code, just like we do not have to write any code for inline edits.


Please consider if you can use any of these features before planning to write your special code.


My plan was to SEEK the value from the GET byt i will try to use standard xbrowse seek and may be on that window of the footer oSeek object will be placed

May we also know the purpose of creating the dialog and get?


I have few problems with SEEKing

1- I dont like to click with mouse everytime the header of column where i want to seek value but to use cursor keys to move to other column and seek some value

2- I have problem with seeking on numeric columns
Test TESTXBR3.PRG, exclude fastedit and try seek on Salary column

If it is descending sort, SEEK DONT WORK at all

If it is ascending sort and for example we want to find valye 13200
When we
click digit "1" xbrowse is going to first (smallest valye) row
click digit "3" still on first row
click digit "2" still on first row
click digit "0" still on first row
click digit "0" NOW is going to row with Salary valye 13200

Probably BUG or i am missing something ...

Best regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: XBROWSE determine FOOTER coordinates

Postby nageswaragunupudi » Sun Aug 18, 2013 4:48 pm

- I have problem with seeking on numeric columns
Test TESTXBR3.PRG, exclude fastedit and try seek on Salary column

I guess you want to start the seek when the user presses a key even before the dbf is sorted on that column. Right?

But before you seek, you got to change the index anyway.

What you can do is to change the order the moment user presses a key and allow the built-in seek system to take over.

Where do we display the seek expression? Showing on the footer may be one way, but in some browses we may use footer to diplay several aggregates and in such cases we may need to place the display of seek expression at a different place. It may be better to display the seek expression consistently at a place which does not clash with other requirement of footers.

have problem with seeking on numeric columns


Not a bug. Logic is to softseek on the expression entered till that keystroke.
I shall look into how to deal with this on descend sorts.

In any case I provided you the function you were looking for.
Regards

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

Re: XBROWSE determine FOOTER coordinates

Postby avista » Tue Aug 20, 2013 6:53 pm

Rao,
Many thanks for all sugestions
Best regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 64 guests