show bitmaps on Header and columns with Xbrowse

show bitmaps on Header and columns with Xbrowse

Postby Silvio » Mon Jan 12, 2009 1:27 am

To create a column in xbrowse I use this line

oCol:= oApp():oGrid:AddCol()
oCol:AddResource("sort1")
oCol:AddResource("sort2")
oCol:AddResource("GRADO1")
oCol:AddResource("GRADO2")
oCol:AddResource("GRADO3")
oCol:AddResource("GRADO4")
oCol:AddResource("GRADO5")
oCol:AddResource("GRADO6")
oCol:AddResource("GRADO7")
oCol:AddResource("GRADO8")
oCol:AddResource("GRADO0")
oCol:cHeader := "Grado"
oCol:bStrData := { || (oDCli)->GRADO}
oCol:bBmpData := { || (oDCli)->GRADO}
oCol:nWidth :=40

oCol:bLClickHeader :={ ||(Sel_Index(5,oDCli) ,;
oApp():oTab:nOption:=5,;
oApp():oTab:refresh()) }

Problem :

I want use for show bitmaps on column from 3° bitmap to 11° bitmap
oCol:AddResource("GRADO1")
oCol:AddResource("GRADO2")
oCol:AddResource("GRADO3")
oCol:AddResource("GRADO4")
oCol:AddResource("GRADO5")
oCol:AddResource("GRADO6")
oCol:AddResource("GRADO7")
oCol:AddResource("GRADO8")
oCol:AddResource("GRADO0")


and the first and second bitmap only for the header :

oCol:AddResource("sort1")
oCol:AddResource("sort2")


the field oCol:bStrData := { || (oDCli)->GRADO}
is numeric ( N 1)

How I can make it ?
Someone can help me please ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: show bitmaps on Header and columns with Xbrowse

Postby Daniel Garcia-Gil » Mon Jan 12, 2009 2:46 am

for change bitmap on header use...
DATA nHeadBmpNo // header ordinal bitmap to use of ::aBitmaps

for change bitmap on cell use...
bBmpData // Ordinal bitmap data codeblock (returns a number in the range 1-len(aBitmaps))

use original fivewin bitmap, from folder \FWH\bitmaps\16x16
Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

// xbrowse imagen button get

static aCellSelected

function main()

local oDlg, oBrw
local aArray := {}
local uVal
local nI
local oGet, oBtn
local nWdGet := 0

for nI = 1 to 20
aadd( aArray, { StrZero(nI,2),;
                        3,;
                        SPACE( 5 ),;
                        SPACE( 5 ),;
                        SPACE( 5 ),;
                        SPACE( 5 ),;
                        SPACE( 5 ),;
                        SPACE( 5 ),;
                        SPACE( 5 ),;
                        SPACE( 5 ),;
                        SPACE( 5 ),;
                        SPACE( 5 ),;
                        SPACE( 5 ) } )
next

DEFINE DIALOG oDlg Title "Test xBrowse III " size 700,300


oBrw:= txbrowse():new( oDlg )
oBrw:nRowHeight := 25
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL //MARQSTYLE_HIGHLROWMS //
oBrw:SetArray( aArray )
oBrw:lFastEdit = .t.
oBrw:CreateFromCode()


for nI = 2 to len( oBrw:aCols )
   oBrw:aCols[ nI ]:AddBmpFile( "gobottom.bmp" )
  oBrw:aCols[ nI ]:AddBmpFile( "gotop.bmp" )
   oBrw:aCols[ nI ]:bLClickHeader := { | nRow, nCol, nFlags, oCol |    if ( oCol:nHeadBmpNo == 1, oCol:nHeadBmpNo := 2, oCol:nHeadBmpNo := 1 ) }
   oBrw:aCols[ nI ]:nHeadBmpNo := 1
next

oBrw:aCols[ 2 ]:AddBmpFile( "textbox.bmp" )
oBrw:aCols[ 2 ]:AddBmpFile( "tips.bmp" )
oBrw:aCols[ 2 ]:AddBmpFile( "toback.bmp" )
oBrw:aCols[ 2 ]:AddBmpFile( "tofront.bmp" )
oBrw:aCols[ 2 ]:AddBmpFile( "toggle.bmp" )
oBrw:aCols[ 2 ]:AddBmpFile( "togrid.bmp" )
oBrw:aCols[ 2 ]:nEditType := EDIT_GET
oBrw:aCols[ 2 ]:bBmpData := {|| if( empty( oBrw:aCols[ 2 ]:value() ), 1, oBrw:aCols[ 2 ]:value() ) }
oBrw:aCols[ 2 ]:bEditValid := {| oEdit | oEdit:value() > 2 }

oDlg:oClient := oBrw

ACTIVATE DIALOG oDlg center on init oDlg:Resize()

return nil
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: show bitmaps on Header and columns with Xbrowse

Postby Silvio » Mon Jan 12, 2009 10:40 am

your sample run ok but I must correction this sources

oCol:= oApp():oGrid:AddCol()
oCol:AddResource("sort1")
oCol:AddResource("sort2")
oCol:nHeadBmpNo := 2
oCol:nHeadBmpAlign := AL_RIGHT
oCol:bLClickHeader :={ ||(Sel_Index(7,oDCli) , oApp():oTab:nOption:=7,oApp():oTab:refresh()) }
oCol:AddResource("DOCENTE")
oCol:AddResource("ALUNNO")
oCol:AddResource("CARTELLA")
oCol:AddResource("GENITORE")
oCol:AddResource("ESTERNO")
oCol:bStrData := { || (oDCli)->ATTIVITA}
oCol:cHeader := "Tipo"
oCol:bEditValue := { || (oDCli)->ATTIVITA }
oCol:nDataStyle := oCol:DefStyle( AL_LEFT, .T.)
oCol:bBmpData := { || (oDCli)->Attivita}
oCol:nWidth :=40




oCol:= oApp():oGrid:AddCol()
oCol:AddResource("sort1")
oCol:AddResource("sort2")
oCol:cHeader := "Grado"
oCol:nHeadBmpNo := 2
oCol:nHeadBmpAlign := AL_RIGHT
oCol:bLClickHeader :={ ||(Sel_Index(6,oDCli) , oApp():oTab:nOption:=6,oApp():oTab:refresh()) }

oCol:AddResource("GRADO1")
oCol:AddResource("GRADO2")
oCol:AddResource("GRADO3")
oCol:AddResource("GRADO4")
oCol:AddResource("GRADO5")
oCol:AddResource("GRADO6")
oCol:AddResource("GRADO7")
oCol:AddResource("GRADO8")
oCol:AddResource("GRADO0")

oCol:bStrData := { || (oDCli)->GRADO}
oCol:bBmpData := { || (oDCli)->GRADO}
oCol:nWidth :=40

.......

Stat FUNC Sel_Index(n,cdbf)
// 1 3 4 6 11 7 8
(cdbf)->(OrdSetFocus(n))
if n = 1
oApp():oGrid:aCols[1]:nHeadBmpNo := 1
oApp():oGrid:aCols[3]:nHeadBmpNo := 2
oApp():oGrid:aCols[4]:nHeadBmpNo := 2
oApp():oGrid:aCols[6]:nHeadBmpNo := 2
oApp():oGrid:aCols[11]:nHeadBmpNo := 2
oApp():oGrid:aCols[8]:nHeadBmpNo := 2
oApp():oGrid:aCols[7]:nHeadBmpNo := 2

elseif n = 2
oApp():oGrid:aCols[1]:nHeadBmpNo := 2
oApp():oGrid:aCols[3]:nHeadBmpNo := 1
oApp():oGrid:aCols[4]:nHeadBmpNo := 2
oApp():oGrid:aCols[6]:nHeadBmpNo := 2
oApp():oGrid:aCols[11]:nHeadBmpNo := 2
oApp():oGrid:aCols[8]:nHeadBmpNo := 2
oApp():oGrid:aCols[7]:nHeadBmpNo := 2

elseif n = 3
oApp():oGrid:aCols[1]:nHeadBmpNo := 2
oApp():oGrid:aCols[3]:nHeadBmpNo := 2
oApp():oGrid:aCols[4]:nHeadBmpNo := 1
oApp():oGrid:aCols[6]:nHeadBmpNo := 2
oApp():oGrid:aCols[11]:nHeadBmpNo := 2
oApp():oGrid:aCols[8]:nHeadBmpNo := 2
oApp():oGrid:aCols[7]:nHeadBmpNo := 2

elseif n = 4
oApp():oGrid:aCols[1]:nHeadBmpNo := 2
oApp():oGrid:aCols[3]:nHeadBmpNo := 2
oApp():oGrid:aCols[4]:nHeadBmpNo := 2
oApp():oGrid:aCols[6]:nHeadBmpNo := 2
oApp():oGrid:aCols[11]:nHeadBmpNo :=1
oApp():oGrid:aCols[8]:nHeadBmpNo := 2
oApp():oGrid:aCols[7]:nHeadBmpNo := 2

elseif n = 5
oApp():oGrid:aCols[1]:nHeadBmpNo := 2
oApp():oGrid:aCols[3]:nHeadBmpNo := 2
oApp():oGrid:aCols[4]:nHeadBmpNo := 2
oApp():oGrid:aCols[6]:nHeadBmpNo := 1
oApp():oGrid:aCols[11]:nHeadBmpNo := 2
oApp():oGrid:aCols[8]:nHeadBmpNo := 2
oApp():oGrid:aCols[7]:nHeadBmpNo := 2

elseif n = 6
oApp():oGrid:aCols[1]:nHeadBmpNo := 2
oApp():oGrid:aCols[3]:nHeadBmpNo := 2
oApp():oGrid:aCols[4]:nHeadBmpNo := 2
oApp():oGrid:aCols[6]:nHeadBmpNo := 2
oApp():oGrid:aCols[11]:nHeadBmpNo := 2
oApp():oGrid:aCols[8]:nHeadBmpNo := 1
oApp():oGrid:aCols[7]:nHeadBmpNo := 2

elseif n = 7

oApp():oGrid:aCols[1]:nHeadBmpNo := 2
oApp():oGrid:aCols[3]:nHeadBmpNo := 2
oApp():oGrid:aCols[4]:nHeadBmpNo := 2
oApp():oGrid:aCols[6]:nHeadBmpNo := 2
oApp():oGrid:aCols[11]:nHeadBmpNo := 2
oApp():oGrid:aCols[8]:nHeadBmpNo := 2
oApp():oGrid:aCols[7]:nHeadBmpNo := 1



//aggiungere per tipo

endif
(cdbf)->(DBGoTop())
oApp():oGrid:Refresh()
oApp():oGrid:SetFocus()
RETURN (NIL)
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 73 guests