FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour more than 1 bmp on a xbrowse column
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
more than 1 bmp on a xbrowse column
Posted: Tue Mar 21, 2023 09:06 PM

Hello everyone;

Can I show more than one single bmp on an xbrowse column object?

Thank you,

Reinaldo.

Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: more than 1 bmp on a xbrowse column
Posted: Tue Mar 21, 2023 09:23 PM

Reinaldo, what would be the use of that necessity?

Why not two columns with a bmp in each one?

Or one with different bmp according to the needs?

It is just out of curiosity...

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: more than 1 bmp on a xbrowse column
Posted: Wed Mar 22, 2023 05:00 AM
This is one of the few ways:
Code (fw): Select all Collapse
// xbrbtns.prg

#include "fivewin.ch"

function Main()

   local oDlg, oFont, oBrw, oBrush

   USE CUSTOMER

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 500,400 PIXEL TRUEPIXEL FONT oFont RESIZABLE

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" ;
      COLUMNS "FIRST", "AGE", "SALARY" ;
      LINES NOBORDER

   WITH OBJECT oBrw
      :nRowHeight    := 30
      WITH OBJECT :Age
         :nWidth        := 100
         :nDataStrAlign := AL_CENTER
         :nHeadStrAlign := AL_CENTER
         :AddBitmap( { FW_BmpPlus( nil, { CLR_WHITE, CLR_GREEN } ), FW_BmpMinus() } )

         // Right Button
         :nEditType     := EDIT_BUTTON
         :bEditBlock    := { |r,c,oCol| oCol:Value + 1 }
         :nBtnBmp       := 1
         :lBtnTransparent  := .t.

         // Left Button
         :bBmpData      := { |v,lSel| If( lSel, 2, 0 ) }
         :bBmpAction    := { |oCol| oCol:VarPut( oCol:Value - 1 ) }
      END
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: more than 1 bmp on a xbrowse column
Posted: Wed Mar 22, 2023 10:51 AM

Second way is to use

  1. bBmpData (left or right align)

  2. bStrImage (any position)

  3. Text any position

Lastly, paint the column on our own using either oBrw:bPaintRow or oCol:bPaintText

I will provide a sample if required

Regards



G. N. Rao.

Hyderabad, India
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: more than 1 bmp on a xbrowse column
Posted: Thu Mar 23, 2023 03:27 AM
Dear Rao gaaru,

As usually, an excellent example of buttons in xBrowser Columns. :D

-Ramesh Babu
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: more than 1 bmp on a xbrowse column
Posted: Thu Mar 23, 2023 04:43 AM

Dear Ramesh Babu

Actually, I posted that sample in a haste.

Later I realized that it is not what he is looking for.

I will post different samples now.

Regards



G. N. Rao.

Hyderabad, India
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: more than 1 bmp on a xbrowse column
Posted: Thu Mar 23, 2023 05:24 PM

Mr Rao -- let me first say: he he he.

"In a haste" but excellent example and clever use of the right side button. It takes imagination to see in how many ways painting various bmps on a cell can be not just beautiful but also very useful.

I have seen it on grids where tags (like stack overflow tags) are shown.

Yes, it would help to see sample code using oCol:bPaintText to paint various bmps based on conditions.

Thank you,

Reinaldo.

Continue the discussion