FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xbrowse icon and filter
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
xbrowse icon and filter
Posted: 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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: xbrowse icon and filter
Posted: 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
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: xbrowse icon and filter
Posted: Thu Dec 12, 2024 01:24 PM

Hi Karinha,

i'd like a column with inside a icon or bitmap with color associated

FiveWin for xHarbour 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: xbrowse icon and filter
Posted: Thu Dec 12, 2024 02:43 PM


Is this what you want ?

A Icon/jpg bases on data
A color based on data
Code (fw): Select all Collapse
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.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xbrowse icon and filter
Posted: Fri Dec 13, 2024 03:53 AM
Code (fw): Select all Collapse
#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
Regards



G. N. Rao.

Hyderabad, India
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: xbrowse icon and filter
Posted: 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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: xbrowse icon and filter
Posted: 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.08 with Harbour

Continue the discussion