more than 1 bmp on a xbrowse column

more than 1 bmp on a xbrowse column

Postby reinaldocrespo » Tue Mar 21, 2023 9:06 pm

Hello everyone;

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

Thank you,

Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: more than 1 bmp on a xbrowse column

Postby cmsoft » Tue Mar 21, 2023 9: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...
User avatar
cmsoft
 
Posts: 1291
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: more than 1 bmp on a xbrowse column

Postby nageswaragunupudi » Wed Mar 22, 2023 5:00 am

This is one of the few ways:
Code: Select all  Expand view  RUN
// 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
 


Image
Regards

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

Re: more than 1 bmp on a xbrowse column

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: more than 1 bmp on a xbrowse column

Postby RAMESHBABU » Thu Mar 23, 2023 3:27 am

Dear Rao gaaru,

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

-Ramesh Babu
User avatar
RAMESHBABU
 
Posts: 625
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: more than 1 bmp on a xbrowse column

Postby nageswaragunupudi » Thu Mar 23, 2023 4: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
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: more than 1 bmp on a xbrowse column

Postby reinaldocrespo » Thu Mar 23, 2023 5: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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 96 guests

cron