Complex array into listbox: some one can help me please ?

Complex array into listbox: some one can help me please ?

Postby Silvio » Mon Jun 09, 2008 4:49 pm

I must create it
http://img505.imageshack.us/img505/8279 ... me2ck8.png

and I have a database with some field :
l_lun
l_mar
l_mer
l_gio
l_ven
l_sab

each field have a string of ten characters as "SSSSSSNSNS"

S := Yes
N := No


I thinked to load all string into array type adatidisp[6,10]


Code: Select all  Expand view

static function CARICA_REC(aDati, aDatiDisp)

    aDatiDisp[1][1]:= Left(aule->l_lun, 1)
    aDatiDisp[1][2]:= SubStr(aule->l_lun, 2, 1)
    aDatiDisp[1][3]:= SubStr(aule->l_lun, 3, 1)
    aDatiDisp[1][4]:= SubStr(aule->l_lun, 4, 1)
    aDatiDisp[1][5]:= SubStr(aule->l_lun, 5, 1)
    aDatiDisp[1][6]:= SubStr(aule->l_lun, 6, 1)
    aDatiDisp[1][7]:= SubStr(aule->l_lun, 7, 1)
    aDatiDisp[1][8]:= SubStr(aule->l_lun, 8, 1)
    aDatiDisp[1][9]:= SubStr(aule->l_lun, 9, 1)
    aDatiDisp[1][10]:= right(aule->l_lun, 1)

   aDatiDisp[2][1]:= Left(aule->l_mar, 1)
   aDatiDisp[2][2]:= SubStr(aule->l_mar, 2, 1)
   aDatiDisp[2][3]:= SubStr(aule->l_mar, 3, 1)
   aDatiDisp[2][4]:= SubStr(aule->l_mar, 4, 1)
   aDatiDisp[2][5]:= SubStr(aule->l_mar, 5, 1)
   aDatiDisp[2][6]:= SubStr(aule->l_mar, 6, 1)
   aDatiDisp[2][7]:= SubStr(aule->l_mar, 7, 1)
   aDatiDisp[2][8]:= SubStr(aule->l_mar, 8, 1)
   aDatiDisp[2][9]:= SubStr(aule->l_mar, 9, 1)
   aDatiDisp[2][10]:= right(aule->l_mar, 1)

   aDatiDisp[3][1]:= Left(aule->l_mer, 1)
   aDatiDisp[3][2]:= SubStr(aule->l_mer, 2, 1)
   aDatiDisp[3][3]:= SubStr(aule->l_mer, 3, 1)
   aDatiDisp[3][4]:= SubStr(aule->l_mer, 4, 1)
   aDatiDisp[3][5]:= SubStr(aule->l_mer, 5, 1)
   aDatiDisp[3][6]:= SubStr(aule->l_mer, 6, 1)
   aDatiDisp[3][7]:= SubStr(aule->l_mer, 7, 1)
   aDatiDisp[3][8]:= SubStr(aule->l_mer, 8, 1)
   aDatiDisp[3][9]:= SubStr(aule->l_mer, 9, 1)
   aDatiDisp[3][10]:= right(aule->l_mer, 1)

   aDatiDisp[4][1]:= Left(aule->l_gio, 1)
   aDatiDisp[4][2]:= SubStr(aule->l_gio, 2, 1)
   aDatiDisp[4][3]:= SubStr(aule->l_gio, 3, 1)
   aDatiDisp[4][4]:= SubStr(aule->l_gio, 4, 1)
   aDatiDisp[4][5]:= SubStr(aule->l_gio, 5, 1)
   aDatiDisp[4][6]:= SubStr(aule->l_gio, 6, 1)
   aDatiDisp[4][7]:= SubStr(aule->l_gio, 7, 1)
   aDatiDisp[4][8]:= SubStr(aule->l_gio, 8, 1)
   aDatiDisp[4][9]:= SubStr(aule->l_gio, 9, 1)
   aDatiDisp[4][10]:= right(aule->l_gio, 1)

   aDatiDisp[5][1]:= Left(aule->l_ven, 1)
   aDatiDisp[5][2]:= SubStr(aule->l_ven, 2, 1)
   aDatiDisp[5][3]:= SubStr(aule->l_ven, 3, 1)
   aDatiDisp[5][4]:= SubStr(aule->l_ven, 4, 1)
   aDatiDisp[5][5]:= SubStr(aule->l_ven, 5, 1)
   aDatiDisp[5][6]:= SubStr(aule->l_ven, 6, 1)
   aDatiDisp[5][7]:= SubStr(aule->l_ven, 7, 1)
   aDatiDisp[5][8]:= SubStr(aule->l_ven, 8, 1)
   aDatiDisp[5][9]:= SubStr(aule->l_ven, 9, 1)
   aDatiDisp[5][10]:= right(aule->l_ven, 1)

   aDatiDisp[6][1]:= Left(aule->l_sab, 1)
   aDatiDisp[6][2]:= SubStr(aule->l_sab, 2, 1)
   aDatiDisp[6][3]:= SubStr(aule->l_sab, 3, 1)
   aDatiDisp[6][4]:= SubStr(aule->l_sab, 4, 1)
   aDatiDisp[6][5]:= SubStr(aule->l_sab, 5, 1)
   aDatiDisp[6][6]:= SubStr(aule->l_sab, 6, 1)
   aDatiDisp[6][7]:= SubStr(aule->l_sab, 7, 1)
   aDatiDisp[6][8]:= SubStr(aule->l_sab, 8, 1)
   aDatiDisp[6][9]:= SubStr(aule->l_sab, 9, 1)
   aDatiDisp[6][10]:= right(aule->l_sab, 1)
   return Nil








Now I want insert all data into a listbox
the first column must be a column of days o a week

AADD( aMat, { "MO" } )
AADD( aMat, { "TU" } )
AADD( aMat, { "WE" } )
AADD( aMat, { "TH" } )
AADD( aMat, { "FR" } )
AADD( aMat, { "SA" } )

and each adatidisp must be insert as a bitmap

for the yes "select.bmp" and for the NO "unselect.bmp"



how I can make to put all in listbox ?
Best Regards, Saludos

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

Postby Otto » Mon Jun 09, 2008 5:12 pm

Silvio, maybe you can use the bus reservation sample from TSButton for your purpose.
Regards,
Otto


Image
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby quique » Mon Jun 09, 2008 5:26 pm

Change it for
Code: Select all  Expand view
static function CARICA_REC(aDati, aDatiDisp)

    aMat, { "MO", ;
              Left(aule->l_lun, 1), ;
              SubStr(aule->l_lun, 2, 1), ;
              SubStr(aule->l_lun, 3, 1), ;
              SubStr(aule->l_lun, 4, 1), ;
              SubStr(aule->l_lun, 5, 1), ;
              SubStr(aule->l_lun, 6, 1), ;
              SubStr(aule->l_lun, 7, 1), ;
              SubStr(aule->l_lun, 8, 1) , ;
              SubStr(aule->l_lun, 9, 1), ;
              right(aule->l_lun, 1) }

Saludos
Quique
User avatar
quique
 
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am

Postby Marcelo Via Giglio » Mon Jun 09, 2008 9:16 pm

Hello,

if you load an array from string you can try this ( Hernan's browse)

Code: Select all  Expand view
FUNCTION test()
   LOCAL oDlg, oLbx, aData, oBmpYes, oBmpNo

   oBmpYes := LoadBitmap ( GetResources(), "X" )
   oBmpNO  := LoadBitmap ( GetResources(), "XX" )

   aData := { {'Lunes',    'S','N','S','S','N','S','S','S','S','S'},;
              {'Martes',   'S','N','S','S','N','S','S','S','S','N'},;
              {'Miercoles','S','N','S','S','N','S','S','S','S','S'},;
              {'Jueves',   'S','N','S','S','N','S','S','S','S','N'},;
              {'Viernes',  'N','N','N','S','N','S','S','S','S','N'},;
              {'Sábado',   'S','N','S','S','N','S','S','S','S','N'},;
              {'Domingo',  'S','N','S','S','N','S','S','S','S','N'};
           }

   DEFINE DIALOG oDLg FROM 1,1 TO 20,30

   @ 1,1 LISTBOX oLbx FIELDS HEADER "","0","1","2","3","4","5","6","7","8","9" OF oDlg

   oLbx:setArray(aData)
   oLbx:bLine:={|| {  aData[oLbx:nAt,1],;
                      IF( aData[oLbx:nAt,2] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,3] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,4] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,5] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,6] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,7] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,8] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,9] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,10] = 'S', oBmpYes, oBmpNo );
                      } }

   ACTIVATE DIALOG oDlg

   RETURN( NIL )


This sample isn't similar to your picture which you sent, but with some work, I think is possible to make some thing close

regards

Marcelo
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Postby xProgrammer » Mon Jun 09, 2008 10:10 pm

Hi

Being a Linux person these days I can't really help on the GUI side but it might be neater and quicker to use

Code: Select all  Expand view
aule->l_mer[3]


in place of

Code: Select all  Expand view
SubStr(aule->l_mer, 3, 1)


and given that you have a series of them look at using (nested) FOR EACHs and / or loops. Perhaps something along the lines of:

Code: Select all  Expand view
aDays := ARRAY( 6 )
aDays[1] := aule->l_lun
aDays[2] := aule->l_mar
aDays[3] := aule->l_mer
aDays[4] := aule->l_gio
aDays[5] := aule->l_ven
aDays[6] := aule->l_sab
FOR ii = 1 TO 6
   thisString := aDays[ii]
   FOR jj = 1 TO 10
      aDatiDisp[ii][jj] := thisString[jj]
   NEXT
NEXT


Regards
xProgrammer
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Silvio » Tue Jun 10, 2008 8:46 am

THANKS , THANKS TO ALL

PERHAPS I FOUND A SOLUTION !!!!




Image







BUT THERE IS AN ERROR ON LAST COLUMN ( FROM 9 TO 10)

I want the listbox into dialog

if I press arrow -> I can see only the last column and I not want move the listbox



Image









LOOK IT and try PLEASE

I COMPILED WITH WBROWSE OF HERNAN



Code: Select all  Expand view
 

#INCLUDE "FIVEWIN.CH"



FUNCTION test()
   LOCAL oDlg, oLbx, aData, oBmpYes, oBmpNo,oFld,oFont
   Local aDati [7]
   Local aDatiDisp[6,10]
   Local lsave :=.f.


   oBmpYes := READBITMAP( 0, "SELECT.BMP" )
   oBmpNO  := READBITMAP( 0, "UNSELECT.BMP" )


   DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0,-8


   USE AULE ALIAS AULE
   GO TOP



   //LOAD DATA from Aule.dbf

   aDati[1]:= aule->cod
   aDati[2]:= aule->descr
   aDati[3]:= aule->max_ore
   aDati[4]:= aule->max_cla
   aDati[5]:= aule->omo_cla
   aDati[6]:= aule->aula_lab
   aDati[7]:= aule->prec



    aDatiDisp[1][1]:= Left(aule->l_lun, 1)
    aDatiDisp[1][2]:= SubStr(aule->l_lun, 2, 1)
    aDatiDisp[1][3]:= SubStr(aule->l_lun, 3, 1)
    aDatiDisp[1][4]:= SubStr(aule->l_lun, 4, 1)
    aDatiDisp[1][5]:= SubStr(aule->l_lun, 5, 1)
    aDatiDisp[1][6]:= SubStr(aule->l_lun, 6, 1)
    aDatiDisp[1][7]:= SubStr(aule->l_lun, 7, 1)
    aDatiDisp[1][8]:= SubStr(aule->l_lun, 8, 1)
    aDatiDisp[1][9]:= SubStr(aule->l_lun, 9, 1)
    aDatiDisp[1][10]:= right(aule->l_lun, 1)

   aDatiDisp[2][1]:= Left(aule->l_mar, 1)
   aDatiDisp[2][2]:= SubStr(aule->l_mar, 2, 1)
   aDatiDisp[2][3]:= SubStr(aule->l_mar, 3, 1)
   aDatiDisp[2][4]:= SubStr(aule->l_mar, 4, 1)
   aDatiDisp[2][5]:= SubStr(aule->l_mar, 5, 1)
   aDatiDisp[2][6]:= SubStr(aule->l_mar, 6, 1)
   aDatiDisp[2][7]:= SubStr(aule->l_mar, 7, 1)
   aDatiDisp[2][8]:= SubStr(aule->l_mar, 8, 1)
   aDatiDisp[2][9]:= SubStr(aule->l_mar, 9, 1)
   aDatiDisp[2][10]:= right(aule->l_mar, 1)

   aDatiDisp[3][1]:= Left(aule->l_mer, 1)
   aDatiDisp[3][2]:= SubStr(aule->l_mer, 2, 1)
   aDatiDisp[3][3]:= SubStr(aule->l_mer, 3, 1)
   aDatiDisp[3][4]:= SubStr(aule->l_mer, 4, 1)
   aDatiDisp[3][5]:= SubStr(aule->l_mer, 5, 1)
   aDatiDisp[3][6]:= SubStr(aule->l_mer, 6, 1)
   aDatiDisp[3][7]:= SubStr(aule->l_mer, 7, 1)
   aDatiDisp[3][8]:= SubStr(aule->l_mer, 8, 1)
   aDatiDisp[3][9]:= SubStr(aule->l_mer, 9, 1)
   aDatiDisp[3][10]:= right(aule->l_mer, 1)

   aDatiDisp[4][1]:= Left(aule->l_gio, 1)
   aDatiDisp[4][2]:= SubStr(aule->l_gio, 2, 1)
   aDatiDisp[4][3]:= SubStr(aule->l_gio, 3, 1)
   aDatiDisp[4][4]:= SubStr(aule->l_gio, 4, 1)
   aDatiDisp[4][5]:= SubStr(aule->l_gio, 5, 1)
   aDatiDisp[4][6]:= SubStr(aule->l_gio, 6, 1)
   aDatiDisp[4][7]:= SubStr(aule->l_gio, 7, 1)
   aDatiDisp[4][8]:= SubStr(aule->l_gio, 8, 1)
   aDatiDisp[4][9]:= SubStr(aule->l_gio, 9, 1)
   aDatiDisp[4][10]:= right(aule->l_gio, 1)

   aDatiDisp[5][1]:= Left(aule->l_ven, 1)
   aDatiDisp[5][2]:= SubStr(aule->l_ven, 2, 1)
   aDatiDisp[5][3]:= SubStr(aule->l_ven, 3, 1)
   aDatiDisp[5][4]:= SubStr(aule->l_ven, 4, 1)
   aDatiDisp[5][5]:= SubStr(aule->l_ven, 5, 1)
   aDatiDisp[5][6]:= SubStr(aule->l_ven, 6, 1)
   aDatiDisp[5][7]:= SubStr(aule->l_ven, 7, 1)
   aDatiDisp[5][8]:= SubStr(aule->l_ven, 8, 1)
   aDatiDisp[5][9]:= SubStr(aule->l_ven, 9, 1)
   aDatiDisp[5][10]:= right(aule->l_ven, 1)

   aDatiDisp[6][1]:= Left(aule->l_sab, 1)
   aDatiDisp[6][2]:= SubStr(aule->l_sab, 2, 1)
   aDatiDisp[6][3]:= SubStr(aule->l_sab, 3, 1)
   aDatiDisp[6][4]:= SubStr(aule->l_sab, 4, 1)
   aDatiDisp[6][5]:= SubStr(aule->l_sab, 5, 1)
   aDatiDisp[6][6]:= SubStr(aule->l_sab, 6, 1)
   aDatiDisp[6][7]:= SubStr(aule->l_sab, 7, 1)
   aDatiDisp[6][8]:= SubStr(aule->l_sab, 8, 1)
   aDatiDisp[6][9]:= SubStr(aule->l_sab, 9, 1)
   aDatiDisp[6][10]:= right(aule->l_sab, 1)




   //PUT data into aData array

   aData := { {'Lunedì',     aDatiDisp[1][1],aDatiDisp[1][2],aDatiDisp[1][3],aDatiDisp[1][4],aDatiDisp[1][5],aDatiDisp[1][6],aDatiDisp[1][7],aDatiDisp[1][8],aDatiDisp[1][9],aDatiDisp[1][10]},;
              {'Martedì',    aDatiDisp[2][1],aDatiDisp[2][2],aDatiDisp[2][3],aDatiDisp[2][4],aDatiDisp[2][5],aDatiDisp[2][6],aDatiDisp[2][7],aDatiDisp[2][8],aDatiDisp[2][9],aDatiDisp[2][10]},;
              {'Mercoledì',  aDatiDisp[3][1],aDatiDisp[3][2],aDatiDisp[3][3],aDatiDisp[3][4],aDatiDisp[3][5],aDatiDisp[3][6],aDatiDisp[3][7],aDatiDisp[3][8],aDatiDisp[3][9],aDatiDisp[3][10]},;
              {'Giovedì',    aDatiDisp[4][1],aDatiDisp[4][2],aDatiDisp[4][3],aDatiDisp[4][4],aDatiDisp[4][5],aDatiDisp[4][6],aDatiDisp[4][7],aDatiDisp[4][8],aDatiDisp[4][9],aDatiDisp[4][10]},;
              {'Venerdi',    aDatiDisp[5][1],aDatiDisp[5][2],aDatiDisp[5][3],aDatiDisp[5][4],aDatiDisp[5][5],aDatiDisp[5][6],aDatiDisp[5][7],aDatiDisp[5][8],aDatiDisp[5][9],aDatiDisp[5][10]},;
              {'Sabato',     aDatiDisp[6][1],aDatiDisp[6][2],aDatiDisp[6][3],aDatiDisp[6][4],aDatiDisp[6][5],aDatiDisp[6][6],aDatiDisp[6][7],aDatiDisp[6][8],aDatiDisp[6][9],aDatiDisp[6][10]},;
           }



   //OPen dialog with Folder

DEFINE DIALOG oDlg  ;
TITLE "# ARCHIVIO COMPLEMENTARE AULE E LABORATORI"  ;
FROM 1,1 to 24,85

  @ 0.5, 1 FOLDER oFld ITEMS "&Generale", "&Giorni/Ore disponibili" ;
      OF oDlg   SIZE 320 ,120



            @ 0, 2 say "Codice...................:"   FONT oFont OF oFld:aDialogs[ 1 ]
            @ 1, 2 say "Descrizione..............:"   FONT oFont OF oFld:aDialogs[ 1 ]
            @ 2, 2 say "Massimo ore insegnamento.:"   FONT oFont OF oFld:aDialogs[ 1 ]
            @ 3, 2 say "Massimo classi presenti..:"   FONT oFont OF oFld:aDialogs[ 1 ]
            @ 4, 2 say "Omogeneita' classi (S/N).:"   FONT oFont OF oFld:aDialogs[ 1 ]
            @ 5, 2 say "Aula/Laboratorio (A/L)...:"   FONT oFont OF oFld:aDialogs[ 1 ]
            @ 6, 2 say "Precedenza (1=max 9=min).:"   FONT oFont OF oFld:aDialogs[ 1 ]

            @ 0, 20 GET aDati[1]   FONT oFont  size 100,10  OF oFld:aDialogs[ 1 ]
            @ 1, 20 GET aDati[2]   FONT oFont  size 100,10  OF oFld:aDialogs[ 1 ]
            @ 2, 20 GET aDati[3]   FONT oFont  size 100,10  OF oFld:aDialogs[ 1 ]
            @ 3, 20 GET aDati[4]   FONT oFont  size 100,10  OF oFld:aDialogs[ 1 ]
            @ 4, 20 GET aDati[5]   FONT oFont  size 100,10  OF oFld:aDialogs[ 1 ]
            @ 5, 20 GET aDati[6]   FONT oFont  size 100,10  OF oFld:aDialogs[ 1 ]
            @ 6, 20 GET aDati[7]   FONT oFont  size 100,10  OF oFld:aDialogs[ 1 ]



             TwBrowse():lVscroll:=.f.
             TwBrowse():lHscroll:=.f.

             @ 0,0.5 LISTBOX oLbx FIELDS HEADER "","1","2","3","4","5","6","7","8","9","10" ;
              OF oFld:aDialogs[ 2 ]  UPDATE   ;
              SIZE 300,110    ;
              SIZES 100, 50, 50, 50,50,50,50,50,50,50,50

                  oLbx:setArray(aData)
                  oLbx:bLine:={|| {  aData[oLbx:nAt,1],;
                                 IF( aData[oLbx:nAt,2] = 'S', oBmpYes, oBmpNo ),;
                                 IF( aData[oLbx:nAt,3] = 'S', oBmpYes, oBmpNo ),;
                                 IF( aData[oLbx:nAt,4] = 'S', oBmpYes, oBmpNo ),;
                                 IF( aData[oLbx:nAt,5] = 'S', oBmpYes, oBmpNo ),;
                                 IF( aData[oLbx:nAt,6] = 'S', oBmpYes, oBmpNo ),;
                                 IF( aData[oLbx:nAt,7] = 'S', oBmpYes, oBmpNo ),;
                                 IF( aData[oLbx:nAt,8] = 'S', oBmpYes, oBmpNo ),;
                                 IF( aData[oLbx:nAt,9] = 'S', oBmpYes, oBmpNo ),;
                                 IF( aData[oLbx:nAt,10] = 'S', oBmpYes, oBmpNo ),;
                                 IF( aData[oLbx:nAt,11] = 'S', oBmpYes, oBmpNo );
                                             } }

     //only wbrowse hernan
       oLbx:nHeaderHeight  := 38
      *   oLbx:nHeaderStyle :=11

     * oLbx:nlineStyle:= 11
        oLbx:nLineHeight  :=  25

       * oLbx:nFreeze:=1
        oLbx:lAdjBrowse:=.F.


  ////////////////////

        oLbx:lCellStyle  := .T.
       * oLbx:Set3DStyle()
        oLbx:aHJustify :={2,2,2,2,2,2,2,2,2,2,2 }
        // to change data
         oLbx:bLClicked = { | nRow, nCol | Cambia( oLbx, nCol ) }



           @ 7.5, 29 BUTTON "&Conferma" OF oDlg SIZE 40,10  ACTION ( lsave:=.F.,oDlg:end())
           @ 7.5, 38 BUTTON "&Annulla" OF oDlg SIZE 40,10 ACTION ( lsave:=.F.,oDlg:end())


   ACTIVATE DIALOG oDlg

   If lsave
      //sAVE ALL DATA

   endif

   RETURN( NIL )





     //change data
   STATIC FUNCTION CAMBIA( oLbx, nCol )

  IF oLbx:nAtCol( nCol ) = 3


      oLbx:Refresh( .F. )
  ENDIF

  RETURN NIL




Another ...
HOW i CAN MAKE TO CHANGE DATA INTO CAMBIA FUNCTION with a click?

Best Regards
silvio


p.s. thanks to all!!!!!!!!!!!!!
Best Regards, Saludos

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

Postby StefanHaupt » Tue Jun 10, 2008 9:43 am

Silvio,

BUT THERE IS AN ERROR ON LAST COLUMN ( FROM 9 TO 10)

I want the listbox into dialog

if I press arrow -> I can see only the last column and I not want move the listbox


you can try to add a dummy column to the browse and adjust the last column

oBrw:nAdjustCol := 10
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby mmercado » Tue Jun 10, 2008 9:45 am

Hi Silvio:

Here you are a simple TSBrowse solution
Image
Code: Select all  Expand view
#include "FiveWin.ch"
#include "TSBrowse.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

Function Main()

   Local oDlg, oBrw, aBmp[ 2 ], aArray, nEle, ;
         aDay := { "MO", "TU", "WE", "TH", "FR", "SA" }

   Use MyDbf Shared New Via "DBFCDX"

   aArray := {}

   For nEle := 1 To FCount()
      AAdd( aArray, CtoA( " " + FieldGet( nEle ) ) )
      aArray[ nEle, 1 ] := aDay[ nEle ]
   Next

   DEFINE BITMAP aBmp[ 1 ] FILENAME "\FWH\BITMAPS\32X32\YES.BMP"
   DEFINE BITMAP aBmp[ 2 ] FILENAME "\FWH\BITMAPS\32X32\NO.BMP"

   DEFINE DIALOG oDlg FROM 0, 0 TO 264, 448 PIXEL TITLE "Silvio's Headache"

   @  0,  0 BROWSE oBrw ARRAY aArray CELLED OF oDlg SIZE 224, 128 PIXEL

   ADD COLUMN TO oBrw DATA ARRAY ELM 1 3DLOOK TRUE, FALSE ;
       COLORS CLR_BLACK, CLR_HGRAY SIZE 40 ALIGN DT_CENTER

   For nEle := 2 To 11
      bData := MakeBlock( oBrw, nEle, aBmp )
      ADD COLUMN TO oBrw DATA bData TITLE LTrim( Str( nEle - 1 ) ) ;
          ALIGN nMakeLong( DT_CENTER, DT_CENTER ) BITMAP SIZE 40 ;
          3DLOOK FALSE, TRUE COLORS CLR_BLACK, CLR_WHITE, CLR_BLACK, CLR_HGRAY
   Next

   With Object oBrw
      :nFreeze := 1
      :lLockFreeze := .T.
      :nHeightCell += 20
      :nHeightHead += 20
      :lNoHScroll := .T.
   End With

   ACTIVATE DIALOG oDlg CENTERED

   aBmp[ 1 ]:End()
   aBmp[ 2 ]:End()
   DbCloseAll()

Return Nil


//----------------------------------------------------------------------------//

Static Function MakeBlock( oBrw, nEle, aBmp )

Return {|| If( oBrw:aArray[ oBrw:nAt, nEle ] == "S", aBmp[ 1 ], aBmp[ 2 ] ) }

//----------------------------------------------------------------------------//


Function CtoA( cString )

   Local nEle, ;
         aArr := {}

      nEle := 1

      While nEle <= Len( cString )
         AAdd( aArr, SubStr( cString, nEle++, 1 ) )
      EndDo

Return aArr

Regards

Manuel Mercado
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Postby Marcelo Via Giglio » Tue Jun 10, 2008 11:56 am

Silvio

use oLbx:nFreeze := 11
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Postby Marcelo Via Giglio » Tue Jun 10, 2008 12:28 pm

Silvio,

this is a functional sample

Code: Select all  Expand view
   LOCAL oDlg, oLbx, aData, oBmpYes, oBmpNo

   oBmpYes := LoadBitmap ( GetResources(), "X" )
   oBmpNO  := LoadBitmap ( GetResources(), "XX" )

   aData := { {'Lunes',    'S','N','S','S','N','S','S','S','S','S'},;
              {'Martes',   'S','N','S','S','N','S','S','S','S','N'},;
              {'Miercoles','S','N','S','S','N','S','S','S','S','S'},;
              {'Jueves',   'S','N','S','S','N','S','S','S','S','N'},;
              {'Viernes',  'N','N','N','S','N','S','S','S','S','N'},;
              {'Sábado',   'S','N','S','S','N','S','S','S','S','N'},;
              {'Domingo',  'S','N','S','S','N','S','S','S','S','N'};
           }

   DEFINE DIALOG oDLg FROM 1,1 TO 20,70

   @ 1,1 LISTBOX oLbx FIELDS HEADER "","0","1","2","3","4","5","6","7","8","9" SIZE 230,100;
                              SIZES 80, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35 ;
                              ON DBLCLICK ( IF( aData[oLbx:nAt, oLbx:nColAct] = 'S', ;
                                                aData[oLbx:nAt, oLbx:nColAct] := 'N', ;
                                                aData[oLbx:nAt, oLbx:nColAct] := 'S'), ;
                                                oLbx:Drawselect() ) OF oDlg

   oLbx:setArray(aData)
   oLbx:bLine:={|| {  aData[oLbx:nAt,1],;
                      IF( aData[oLbx:nAt,2] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,3] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,4] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,5] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,6] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,7] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,8] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,9] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,10] = 'S', oBmpYes, oBmpNo ),;
                      IF( aData[oLbx:nAt,11] = 'S', oBmpYes, oBmpNo );
                   } }

   oLbx:nFreeze       := 11
   oLbx:lCellstyle    := .T.
   oLbx:aJustify      := {2,2,2,2,2,2,2,2,2,2,2}
   oLbx:nHeaderHeight := 20
   oLbx:nLineHeight   := 20
   oLbx:lVScroll      := .F.
   oLbx:lHScroll      := .F.

   ACTIVATE DIALOG oDlg
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Postby Silvio » Tue Jun 10, 2008 3:04 pm

Thanks to ALL and to :
EMG
OTTO
QUIQUE
Marcelo Via Giglio
xProgrammer
StefanHaupt
Maestro Manuel Mercado



Image



I was trying to converte my old Dos clipper application and U helped me . Thanks!!
Best Regards, Saludos

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

Postby Silvio » Tue Jun 17, 2008 7:45 am

now I have the same problem but it is different


hour MO | TU | WE | TH | FR | SA | ----------------->header
1
-------------------------------------------------------------------------------
2
-------------------------------------------------------------------------------
3
-------------------------------------------------------------------------------
4
-------------------------------------------------------------------------------
5
------------------------------------------------------------------------------
6
-----------------------------------------------------------------------------
7
-------------------------------------------------------------------------------
8
-------------------------------------------------------------------------------
9
-------------------------------------------------------------------------------
10
-------------------------------------------------------------------------------

AND i NOT INSERT BITMAP BUT ONLY TWO LINE OF WORDS
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 83 guests