hbpgsql/harbour + xbrowse

hbpgsql/harbour + xbrowse

Postby luiz53 » Thu May 05, 2011 1:51 pm

gostaria de saber como usar xbrowse com hbpgsql

"I would like to know how to use xbrowse hbpgsql"

HARBOUR CVS....
luiz53
 
Posts: 43
Joined: Fri Jun 01, 2007 12:41 pm

Re: hbpgsql/harbour + xbrowse

Postby nageswaragunupudi » Thu May 05, 2011 5:56 pm

Hope you will be able to open a table object with a query.

If the class of the object has some minimum methods like goto, gotop, recno, etc.xbrowse may be able to browse the object.

Please help me to try testing this:

First open the table / query in your own way. Let us call the object oQry. Then test whether xbrowse can automatically browse the object by:

Code: Select all  Expand view

? XBrowsableObj( oQry ).
 

If the result is .T., then xbrowse can browse the object without much effort from your side. In such a case, next step is:
Code: Select all  Expand view

DEFINE WINDOW oWnd
@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE oQry FIELDS oQry:FieldGet(1) // or whatever way you access the fields.
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd
 

Depending on the results, I can guide you next.
Regards

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

Re: hbpgsql/harbour + xbrowse

Postby luiz53 » Fri May 06, 2011 9:08 am

nageswaragunupudi wrote:Hope you will be able to open a table object with a query.

If the class of the object has some minimum methods like goto, gotop, recno, etc.xbrowse may be able to browse the object.

Please help me to try testing this:

First open the table / query in your own way. Let us call the object oQry. Then test whether xbrowse can automatically browse the object by:

Code: Select all  Expand view

? XBrowsableObj( oQry ).
 

If the result is .T., then xbrowse can browse the object without much effort from your side. In such a case, next step is:
Code: Select all  Expand view

DEFINE WINDOW oWnd
@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE oQry FIELDS oQry:FieldGet(1) // or whatever way you access the fields.
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd
 

Depending on the results, I can guide you next.


return .F.
luiz53
 
Posts: 43
Joined: Fri Jun 01, 2007 12:41 pm

Re: hbpgsql/harbour + xbrowse

Postby luiz53 » Sat May 07, 2011 10:27 pm

hello ;

G. N. Rao. Hyderabad, India

know what can I do?



saberia oque posso fazer ?
luiz53
 
Posts: 43
Joined: Fri Jun 01, 2007 12:41 pm

Re: hbpgsql/harbour + xbrowse

Postby nageswaragunupudi » Sun May 08, 2011 9:27 am

Please try adopting the following code to your query.
Code: Select all  Expand view
function PgQryBrowse( oQry )

   DEFINE WINDOW oWnd
   
   @ 0,0 XBROWSE oBrw OF oWnd ;
         FIELDS oQry:FieldGet( 1 ), oQry:FieldGet( 2 ) ;
         HEADERS oQry:FieldName( 1 ), oQry:FieldName( 2 ) ;
         CELL LINES
   
   WITH OBJECT oBrw
      :nDataType        := DATATYPE_USER
     
      :bGoTop           := { || oQry:GoTo( 1 ) }
      :bGoBottom        := { || oQry:GoTo( oQry:LastRec() ) }
      :bKeyCount        := { || oQry:LastRec() }
      :bKeyNo           := ;
      :bBookMark        := { |n| If( n == nil, oQry:RecNo(), ( oQry:GoTo( Max( n, oQry:LastRec() ) ), oQry:RecNo() ) ) }
      :bBof             := { || oQry:Bof() }
      :bEof             := { || oQry:Eof() }
      :bSkip            := { |n| PgSkipper( oQry, n ) }
     
   END
   
   oBrw:CreateFromCode()
   oWnd:oClient         := oBrw
   
   ACTIVATE WINDOW oWnd
   
return nil

function PgSkipper( oQry, nToSkip )

   local nSkipped    := 0
   local nRecNo      := oQry:RecNo()
   
   DEFAULT nToSkip   := 1
   
   if oQry:LastRec() > 0
      oQry:GoTo( Max( 1, Min( nRecNo + nToSkip, oQry:LastRec() ) ) )
      nSkipped          := oQry:RecNo() - nRecNo
   endif

return nSkipped
 

Please test and post the results.
Regards

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

Re: hbpgsql/harbour + xbrowse

Postby luiz53 » Sun May 08, 2011 10:06 pm

I did the test shows only one record ...
and the bank has 10 000 records
luiz53
 
Posts: 43
Joined: Fri Jun 01, 2007 12:41 pm

Re: hbpgsql/harbour + xbrowse

Postby nageswaragunupudi » Mon May 09, 2011 12:55 am

luiz53 wrote:I did the test shows only one record ...
and the bank has 10 000 records

I am sorry, there was a small mistake in the code I posted originally. I corrected the above code in PgSkipper() function.
Please use the revised code above
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], lzanardo, nageswaragunupudi and 32 guests