xbrowse icon and filter

xbrowse icon and filter

Postby damianodec » Thu Dec 12, 2024 12:03 pm

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 ?
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 422
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: xbrowse icon and filter

Postby karinha » Thu Dec 12, 2024 12:31 pm

Maybe:

\samples\TESTMERG.PRG

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xbrowse icon and filter

Postby damianodec » Thu Dec 12, 2024 1:24 pm

Hi Karinha,
i'd like a column with inside a icon or bitmap with color associated
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 422
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia


Re: xbrowse icon and filter

Postby Marc Venken » Thu Dec 12, 2024 2:43 pm

Image

Is this what you want ?

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

Code: Select all  Expand view  RUN


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

 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: xbrowse icon and filter

Postby nageswaragunupudi » Fri Dec 13, 2024 3:53 am

Code: Select all  Expand view  RUN
#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
Regards

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

Re: xbrowse icon and filter

Postby damianodec » Mon Dec 16, 2024 10:42 am

thank you!!!
next step is filter for each column.
the example of Mark is good for me.
Any example ?
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 422
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: xbrowse icon and filter

Postby Marc Venken » Mon Dec 16, 2024 11:05 am

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
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 41 guests