Share add on xbrowse setmysql(),ntotal(),auto mutilines

Share add on xbrowse setmysql(),ntotal(),auto mutilines

Postby ShumingWang » Mon Dec 03, 2007 1:51 am

1.
METHOD SetMySQL(oquery) CLASS TXBrowse

DEFAULT ::bGoTop := {|| oQuery: GoTop() },;
::bGoBottom := {|| oQuery: GoBottom() },;
::bSkip := {| n |oQuery: SKIP( n ) },;
::bSkipper := {| n |oQuery: SKIPPER( n ) },; // not reach eof() +1
::bBof := {|| oQuery: Bof() },;
::bEof := {|| oQuery: Eof() },;
::bBookMark := {| n | if( n == nil, oQuery:RecNo(),oQuery:Goto( n ))},;
::bKeyNo := ::bBookMark,;
::bKeyCount := {|| oQuery:LastRec() },;
::odbf:=oQuery

return nil

http://www.xtech.com.cn/down/tmysql.prg

2 .
Method nTotal() class TXbrowse
local i,i2,i1

::lfooter:=.t.
if len(::acols)>1; ::acols[1]:cfooter:="Total"; end

for i:=2 to len(::acols)
if len(::acols[i]:cfooter)>=1
::acols[i]:cfooter:=" "
end
next
eval(::bgotop)
while !eval(::bEof)
if len(::aSelected)>0.and.aScan(::aSelected,(Eval(::bKeyNo)))==0; Eval(::bSkip); loop; end
for i2:=2 to len(::acols)
if len(::acols[i2]:cfooter)>=1
::acols[i2]:cfooter:=cvaltochar(val(::acols[i2]:cfooter)+val(cvaltochar(eval(::acols[i2]:bStrData))))
end
next i2
eval(::bSkip)
end


::adjust()
::GoTop()
::Refresh()
Return Nil


3. Auto multi lines data
METHOD PaintData( nRow, nCol, nHeight, lHighLite, lSelected, nOrder ) CLASS TXBrwColumn


...

SetBkColor( hDC, aColors[ 2 ] )

// add the line
::nDataStyle := ::DefStyle( ::nDataStrAlign, (::obrw:dataheight()/::DataHeight()<2 ) )


DrawTextEx( hDC, cData,;
...

:)

Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Postby richard-service » Mon Dec 03, 2007 2:11 am

Hi ShumingWang,

Thanks for your code.

Regards,

Richard
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 60 guests