From Tcbrowse to Xbrowse Bitmap Problem

From Tcbrowse to Xbrowse Bitmap Problem

Postby kokookao2007 » Wed Jan 14, 2009 7:19 am

Hi Everyone:

How to Transfer Column Bitmap From Tcbrowse to Xbrowse ?

local aPics:= { ;
LoadBitmap( GetResources() , "WORK_DONE" ) ,;
LoadBitmap( GetResources() , "CHK_OFF" ) ,;
LoadBitmap( GetResources() , "KS_WRITE" ) ,;
LoadBitmap( GetResources() , "KS_DISK14" ) }

...
...
...

REDEFINE COLUMN XBROWSE oBrw ID 201 OF oDlg ;
UPDATE

ADD COLUMN TO XBROWSE oBrw BITMAP DATA IF(!EMPTY(SERVICE->DONE),aPics[1],aPics[2]) ;
HEADER "Ok" SIZE 25

ADD COLUMN TO XBROWSE oBrw BITMAP DATA IF(SERVICE->POINT=0,aPics1[3], aPics1[SERVICE->POINT]) ;
HEADER "Time" SIZE 25

ADD COLUMN TO XBROWSE oBrw BITMAP DATA IF(!EMPTY(SERVICE->EDIT_DONE),aPics[3],aPics[2]) ;
HEADER "Ch" SIZE 25

ADD COLUMN TO XBROWSE oBrw BITMAP DATA IF(!EMPTY(SERVICE->UPDATE),aPics[4],aPics[2]);
HEADER "New" SIZE 25

...
...
Everything is ok , But Bitmap of Column of Xbrowse not Work as what I want. Just Show Some numbers now.

--
Best Regards
--------------------------------------------------------------
kokoo KAO
-------------
best regards
kokoo Kao
User avatar
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Re: From Tcbrowse to Xbrowse Bitmap Problem

Postby kokookao2007 » Thu Jan 15, 2009 1:27 am

hi:
I try to edit source as some sample of Xbrowse , but still not see Btimap .
Any Idea ?

ADD COLUMN TO XBROWSE oBrw BITMAP DATA IF(!EMPTY(SERVICE->DONE),aPics[1],aPics[2]) ;
HEADER "Ok" SIZE 25

==>

oCol := oBrw:AddCol()
oCol:cHeader := "Ok"
oCol:AddResource("WORK_DONE")
oCol:AddResource("CHK_OFF" )
oCol:bBmpData := { || IIF(!EMPTY(SERVICE->DONE),1,2) }
oCol:nWIDTH := 25

--
Best Regards
--------------------------------------------------------------
kokoo KAO
-------------
best regards
kokoo Kao
User avatar
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Re: From Tcbrowse to Xbrowse Bitmap Problem

Postby ukoenig » Thu Jan 15, 2009 1:53 am

Hello,

a sample with a Array, how it works :
( A sample with a Database is included in the source as well )

Image

Code: Select all  Expand view

// Define the Data-Array
// --------------------------
PRIVATE aBRCOLOR[10][2]
aBRCOLOR[1] := { " 1", "Black" }
aBRCOLOR[2] := { " 2", "White" }
aBRCOLOR[3] := { " 3", "Blue" }
aBRCOLOR[4] := { " 4", "Green" }
aBRCOLOR[5] := { " 5", "Red" }
aBRCOLOR[6] := { " 6", "Yellow" }
aBRCOLOR[7] := { " 7", "Magenta" }
aBRCOLOR[8] := { " 8", "Select" }

// xBrowser from Resource ( Folder ) with Line and Color Settings
// -------------------------------------------------------------------------
oLbx := TXBrowse():New( oFld:aDialogs[1] )
oLbx:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbx:nColDividerStyle := LINESTYLE_BLACK
oLbx:nRowDividerStyle := LINESTYLE_BLACK
oLbx:nRecSelColor = 15512898
oLbx:bClrSelFocus = { || { 16777215, 15512898 } }
oLbx:bClrSel = { || { 16777215, 15512898 } }

Set the Data-Array
// ------------------
oLbx:SetArray( aBRCOLOR )

// The Header
// --------------
oLbx:aCols[ 1 ]:cHeader = Padr("No.", 3)
oLbx:aCols[ 2 ]:cHeader = Padr("Color", 19)

Some Settings
// --------------
oLbx:lHScroll := .F.
oLbx:lVScroll := .F.
oLbx:lFooter := .T.
oLbx:nFooterHeight := 7

// Actions start at Row-Position
// ----------------------------------
oLbx:bLClicked := { | nRow, nCol | POS := oLbx:nRowSel, YOUR FUNCTION() }
// The same Function if You want it changing the Row
// oLbx:bChange   := { || POS := oLbx:nRowSel, YOUR FUNCTION() }

// The Bitmaps, to show together with the Data in Column 2
//--------------------------------------------------------------------
oLbx:aCols[ 2 ]:AddResource("Black")
oLbx:aCols[ 2 ]:AddResource("White")
oLbx:aCols[ 2 ]:AddResource("Blue")
oLbx:aCols[ 2 ]:AddResource("Green")
oLbx:aCols[ 2 ]:AddResource("Red")
oLbx:aCols[ 2 ]:AddResource("Yellow")
oLbx:aCols[ 2 ]:AddResource("Magenta")
oLbx:aCols[ 2 ]:AddResource("Select")

// The BMP's are added to the lefthand-side of Column 2
// Col 1     Col 2
// Nr.      Color
//  1       BMP + Color
//---------------------------------------------------------
oLbx:aCols[ 2 ]:bBmpData := {|| oLbx:nArrayAt }

// oLbx:nArrayAt := POS
// oLbx:nRowSel := POS

oLbx:CreateFromResource( 100 )


// Using BMP from Resources WITH A DATABASE
// ------------------------------------------------------

oLbx := TXBrowse():New( oDlg )
oLbx:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbx:nColDividerStyle := LINESTYLE_BLACK
oLbx:nRowDividerStyle := LINESTYLE_BLACK
oLbx:nRecSelColor = 15512898
oLbx:bClrSelFocus = { || { 16777215, 15512898 } }
oLbx:bClrSel = { || { 16777215, 15512898 } }

// Add new Column
// --------------------
oCol := oLbx:AddCol()
oCol:bStrData  := { || (1)->dLDNR}
oCol:cHeader   := "Source-File"
oCol:nWidth  := 120
oCol := oLbx:AddCol()

// Two BMP-Resources
// -----------------------
oCol:AddResource("RED")        // Resource 1
oCol:AddResource("GREEN")  // Resource 2

oCol:cHeader  := "Project"

// IF deleted, use Red ( 1 ) if not, use Green ( 2 )
// -------------------------------------------------------
oCol:bBmpData   := { || IIF( (1)->(DELETED()), 1, 2) }
oCol:bStrData  := { || (1)->dNAME }
oCol:nWidth  := 305

oCol := oLbx:AddCol()
oCol:cHeader  := "FWH"
oCol:bStrData  := { || (1)->d_FWHVERS }
oCol:nWidth  := 50

....
....
....



I hope it helps.
If You need, I can add a DBF-sample with the same logic.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: From Tcbrowse to Xbrowse Bitmap Problem

Postby kokookao2007 » Thu Jan 15, 2009 3:23 am

HI ukoenig :

Think you for your kindly and powerful help.

After edit some source code as yours sample , It work now .

--
Best Regards
--------------------------------------------------------------
kokoo KAO
-------------
best regards
kokoo Kao
User avatar
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 85 guests