Hi,
Can someone share a code snippet to view image from resource in a column based on a flag in the dbf currently being viewed?
TIA
xBrowse: How to display image from resource based on flag
xBrowse: How to display image from resource based on flag
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse: How to display image from resource based on flag
This sample demonstrates 3 alternative ways of doing it.
RC file:
In all the 3 cases, the result is :
Code: Select all
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
USE CUSTOMER NEW SHARED ALIAS CUST VIA "DBFCDX"
Sample1()
Sample2()
Sample3()
return nil
function Sample1()
local oDlg, oBrw
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
DATASOURCE "CUST" ;
COLUMNS "FIRST", "CITY", "MARRIED" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:married:SetCheck( { "TWO", "ONE" } )
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return nil
function Sample2()
local oDlg, oBrw
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
DATASOURCE "CUST" ;
COLUMNS "FIRST", "CITY", "" ;
HEADERS nil, nil, "MARRIED" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
WITH OBJECT :married
:AddBitmap( { "ONE", "TWO" } )
:bBmpData := { || If( ( oBrw:cAlias )->MARRIED, 2, 1 ) }
END
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return nil
function Sample3()
local oDlg, oBrw
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
DATASOURCE "CUST" ;
COLUMNS "FIRST", "CITY", "IF(MARRIED,'TWO','ONE')" ;
HEADERS nil, nil, "MARRIED" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
WITH OBJECT :married
:cDataType := "P"
:lBmpTransparent := .t.
END
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return nil
Code: Select all
ONE 10 "c:\fwh\bitmaps\32x32\user.bmp"
TWO BITMAP "c:\fwh\bitmaps\32x32\users.bmp"
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: xBrowse: How to display image from resource based on flag
Thank you very much for the extensive example Rao!
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC