LISTBOX with BItMAPS and colors

LISTBOX with BItMAPS and colors

Postby Silvio » Thu May 07, 2009 11:20 pm

sample
Code: Select all  Expand view
STATIC FUNCTION Client()

   local oDlgClient
   local oLbx
   local cVar
   local aHBitMaps:=Array( 5 )
   local n




         aHBitMaps:= { ReadBitmap( 0, CurDir() +"\Level1.bmp" ), ; // BitMaps de 14 x 32
                       ReadBitmap( 0, CurDir() +"\Level2.bmp" ), ;
                       ReadBitmap( 0, CurDir() +"\Level3.bmp" ), ;
                       ReadBitmap( 0, CurDir() +"\Level4.bmp" ),;
                       ReadBitmap( 0, CurDir() +"\Level5.bmp" ) }

    USE ( CurDir() + "\Clientes" ) VIA "DBFCDX"


   if RecCount() == 0
      APPEND BLANK
   endif

    if ! File( CurDir() + "\CliName.CDX" )
      INDEX ON Clientes->Nombre TO ( CurDir() + "\CliName" )
   endif

   Clientes->( OrdSetFocus( "CliName" ) )
   Clientes->( DbGoTop() )


   DEFINE DIALOG oDlgClient  TITLE "Clienti"

            @ 0,  1 SAY " &Anagrafica clienti"  OF oDlgClient  SIZE 60,10

            @ 1, 0  LISTBOX oLbx FIELDS aHBitmaps[ Max( 1, Clientes->Nivel ) ],;
                                        Clientes->Nombre, AllTrim( Clientes->Direccion ),;
                                        Clientes->Telefono,;
                                        Str( Clientes->Edad, 3 ) ;
                                 HEADERS    "L", "Name", "Address", "Phone", "Age" ;
                                 FIELDSIZES 16, 95, 100, 14, 8 ;
                                 SIZE 119, 120 OF oDlgClient


       // Lets use different row colors
  oLbx:nClrText      = { || SelColor( Clientes->Nivel ) }
  oLbx:nClrForeFocus = { || SelColor( Clientes->Nivel ) }


   ACTIVATE DIALOG oDlgClient
return nil
static function SelColor( nNivel )

   local nColor := CLR_BLACK

   do case
      case nNivel == 1
           nColor = CLR_HRED

      case nNivel == 2
           nColor = CLR_HGREEN

      case nNivel == 3
           nColor = CLR_HBLUE
   endcase

return nColor









 


why not run ? I see the rows in black
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 Pocket PC

Who is online

Users browsing this forum: No registered users and 23 guests