Page 1 of 1

xbrowse icon and filter

Posted: Thu Dec 12, 2024 12:03 pm
by damianodec
Hi,
I have a xbrowse that read data by ADOdb.

there are 4 columns: NAME, CITY, AGE, COLOR

in the field COLOR I can only insert 4 option: AR, AB, AC, AO

I would like that xbrowse shows a little icon or bitmap with a color associated (AR YELLOW, AB BLUE, AC GREEN, AO RED)

How can I do it ?

Re: xbrowse icon and filter

Posted: Thu Dec 12, 2024 12:31 pm
by karinha
Maybe:

\samples\TESTMERG.PRG

Regards, saludos.

Re: xbrowse icon and filter

Posted: Thu Dec 12, 2024 1:24 pm
by damianodec
Hi Karinha,
i'd like a column with inside a icon or bitmap with color associated

Re: xbrowse icon and filter

Posted: Thu Dec 12, 2024 2:24 pm
by karinha

Re: xbrowse icon and filter

Posted: Thu Dec 12, 2024 2:43 pm
by Marc Venken
Image

Is this what you want ?

A Icon/jpg bases on data
A color based on data

Code: Select all | Expand


static aBmp := { "c:\marc32\bitmaps\16x16\yes.bmp",;
"c:\marc32\bitmaps\16x16\stop.bmp",;
"c:\marc32\bitmaps\16x16\help2.bmp",;
"c:\marc32\bitmaps\16x16\additem.bmp" }

           oBrw[6]:Akt:bClrStd := { || MyColors("WEBSHOPPRIJZEN","AKTIEF",oBrw[6])}

           WITH OBJECT :Akt
             :AddBitmap( aBmp )
             :bBmpData := {|| AktiefBmp(oBrw:Akt:Value) }
           END

FUNCTION AktiefBmp(nValue)
     do case
      case nValue == 0
         RETURN(2)
      case nValue == 1
         RETURN(1)
      case nValue == 2
         RETURN(3)
      case nValue == 3
         RETURN(3)
      case nValue == 4
         RETURN(4)
     endcase
RETURN(1)

Function MyColors( cBrowse, cType, oBrw )
    local aColors := { CLR_BROWSE1, CLR_BROWSE2 }
    do case
      case cBrowse = "ARTIKEL_ZOEKLIJST" .and. cType = "BENAMING"
         do case
            case right(alltrim(oBrw:code:value),2) = "00"
               aColors := { nClrTxtBrw, CLR_SOFTYELLOW }
          otherwise
              aColors := { nClrTxtBrw, If( oBrw:KeyNo() % 2 == 0, CLR_BROWSE2,CLR_BROWSE1)}
         endcase
      case cBrowse = "WEBSHOPPRIJZEN" .and. cType = "AKTIEF"
         do case
          case oBrw:akt:value = 3
            aColors := { nClrTxtBrw, MY_ORANGE }
          case oBrw:akt:value = 1
            aColors := { nClrTxtBrw, MY_LIGHTYELLOW }
          otherwise
            aColors := { nClrTxtBrw, If( oBrw:KeyNo() % 2 == 0, CLR_BROWSE2,CLR_BROWSE1)}
         endcase
    //  ...... ALL Color Systems
    endcase

return aColors

 

Re: xbrowse icon and filter

Posted: Fri Dec 13, 2024 3:53 am
by nageswaragunupudi

Code: Select all | Expand

#include "fivewin.ch"

function Main()

   local aData, aclr := { "AR", "AB", "AC", "AO" }

   aData := {{"Homers","Springfield",50,"AB"},;
             {"Ceci",  "Miami",      28,"AC"},;
             {"Reg",   "Scottsdale", 43,"AO"},;
             {"David", "Hingham",    34,"AR"},;
             {"Hugh",  "Tarzana",    89,"AB"} }

   XBROWSER aData SETUP ( ;
      oBrw:cHeaders := { "NAME", "CITY", "AGE", "COLOR" }, ;
      oBrw:Color:AddBitmap( { "..\bitmaps\fdem5.bmp", ;
         "..\bitmaps\fdem7.bmp", "..\bitmaps\fdem2.bmp", ;
         "..\bitmaps\fdem9.bmp" } ), ;
      oBrw:Color:bBmpData := { |v| AScan( aClr, v ) } )

return nil
 
Image

Re: xbrowse icon and filter

Posted: Mon Dec 16, 2024 10:42 am
by damianodec
thank you!!!
next step is filter for each column.
the example of Mark is good for me.
Any example ?

Re: xbrowse icon and filter

Posted: Mon Dec 16, 2024 11:05 am
by Marc Venken
I use 2 sort of filters.

1. Filters created by me and let the user select them from a pulldown menu. (Filters are stored in dbf file and used corresponding a specific XBrwowse
These filters are not for change by user

2. Use the build-in filter system from xbrowse using aBarGet system. (every column can have a filter field... the yellow get, see pic posted before)
I use this in almost all xbrowsers because the filters can be made in many combinations.

Mostly I store filters that I made from option 2 and think of using more in the future, in the system of option 1 by clicking a hotkey