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

Post Reply
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

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

Post by ShumingWang »

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:cfooter)>=1
::acols: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
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Post by richard-service »

Hi ShumingWang,

Thanks for your code.

Regards,

Richard
Post Reply