To Nages : How change an value on an array

To Nages : How change an value on an array

Postby Eoeo » Wed Aug 15, 2012 8:09 am

I have this array

aData := { {'Lunedi', "S","S","S","S","S","N","S","S","S","S" },;
{'Martedi', "S","S","S","S","S","S","S","S","S","S" },;
{'Mercoledi', "S","S","S","S","S","S","S","S","S","S" },;
{'Giovedi', "S","S","S","S","S","N","S","S","S","S"},;
{'Venerdi', "S","S","S","S","S","S","S","S","S","S"},;
{'Sabato', "S","S","S","S","S","S","S","S","S","S" } ;
}


DEFINE DIALOG oDlg ;
TITLE "test xbrowse check" ;
SIZE nWidth, nHeight

@ 2.3, 2 FOLDEREX oFld PIXEL ADJUST ;
ITEMS "&Anagrafica";
SIZE 215,151 ANIMATE SPEED



@ 3, 5 XBROWSE oLbx OF oFld:adialogs[1] ;
CELL SIZE 200,120 PIXEL NOBORDER

oLbx:SetArray(aData)
// oLbx:nMarqueeStyle :=MARQSTYLE_HIGHLWIN7
oLbx:lHScroll := .f.
oLbx:lVScroll := .f.
oLbx:aCols[1]:cHeader := i18n("Giorni")
oLbx:nColDividerStyle := LINESTYLE_LIGHTGRAY
oLbx:lColDividerComplete := .t.
oLbx:lRecordSelector := .f.
oLbx:nDataType := 1 // array
oLbx:nStretchCol := -1




FOR i := 2 TO LEN(oLbx:aCols)
oCol := oLbx:aCols[ i ]
oCol:nWidth := 30
oCol:cHeader := alltrim(str(i-1))
* oCol:AddResource("CHECK2")
* oCol:AddResource("CHECK3")

oCol:AddBmpFile(".\BITMAPS\ok_32.BMP" )
oCol:AddBmpFile(".\BITMAPS\no_32.BMP" )
oCol:bBmpData := { || if(aData[oLbx:nArrayAt,2]=="S",1,2)}
oCol:bStrData := {|| NIL }
oCol:bClrSelFocus := { || { CLR_BLACK, nRGB(202,224,252) } }
NEXT



i WISH CLICK ON A CELL AND CHANGE THE VALUE AND REFRESH THE BITMAP , IT IS POSSIBLE ?
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: To Nages : How change an value on an array

Postby nageswaragunupudi » Wed Aug 15, 2012 4:27 pm

Using .t. and .f. instead of 'S' and 'N' makes logic much simple.
Please compile and test this program., replacing your own bitmaps.
Code: Select all  Expand view
#include "FiveWin.Ch"
#include "xbrowse.ch"
#include "hbcompat.ch"

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

function Main()

   local oDlg, oBrw, aData, n

   aData := {  {'Lunedi',     .t.,.t.,.t.,.t.,.t.,.f.,.t.,.t.,.t.,.t. },;
               {'Martedi',    .t.,.t.,.t.,.t.,.t.,.t.,.t.,.t.,.t.,.t. },;
               {'Mercoledi',  .t.,.t.,.t.,.t.,.t.,.t.,.t.,.t.,.t.,.t. },;
               {'Giovedi',    .t.,.t.,.t.,.t.,.t.,.f.,.t.,.t.,.t.,.t. },;
               {'Venerdi',    .t.,.t.,.t.,.t.,.t.,.t.,.t.,.t.,.t.,.t. },;
               {'Sabato',     .t.,.t.,.t.,.t.,.t.,.t.,.t.,.t.,.t.,.t. } ;
            }

   DEFINE DIALOG oDlg SIZE 450,400 PIXEL
   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE aData AUTOCOLS ;
      HEADERS "Gironi" ;
      LINES NOBORDER

   for n := 2 to Len( oBrw:aCols )
      WITH OBJECT oBrw:aCols[ n ]
         :cHeader    := LTrim( Str( n - 1 ) )
         :SetCheck( { "c:\fwh\bitmaps\32x32\yes.bmp", "c:\fwh\bitmaps\32x32\no.bmp" }, .t. )
      END
   next
   WITH OBJECT oBrw
      :lHScroll := :lVScroll := :lRecordSelector := .f.
      :nWidths       := 30
      :nStretchCol   :=  1
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

return nil

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

Please adopt the above logic to your situation.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: To Nages : How change an value on an array

Postby ukoenig » Thu Aug 16, 2012 6:53 pm

Silvio,

I think, the Result You are looking for ?
I added a complete new DBF-structure-logic.
Each Record is a new name or Project.

Image

Best Regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: To Nages : How change an value on an array

Postby Eoeo » Fri Aug 17, 2012 5:27 pm

the command right was setcheck() Irememer there was a command!! ... only now I have the problem I not have .t. And .F. but S and N and I must change all procedures of application because this scheme is into different procedure
This application is an old clipper application 16 bit and re made for fwh with listbox andnow I wish modify all listbox into xbrowse table because wbrowse not have w7 effect

Dear Nages

to not change the application can I make
a type as :

:SetCheck( { IIF( aData[oBrw:nArrayAt,2]="S","c:\work\fwh\bitmaps\32x32\yes.bmp", "c:\work\fwh\bitmaps\32x32\no.bmp"),;
IIF( aData[oBrw:nArrayAt,2]="S","c:\work\fwh\bitmaps\32x32\yes.bmp", "c:\work\fwh\bitmaps\32x32\no.bmp") },;
.t. )
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: To Nages : How change an value on an array

Postby Eoeo » Fri Aug 17, 2012 5:57 pm

Perhaps I founded a solution

aDatiDisp[1][1]:= IIF(Left(DO->l_lun, 1)="S",.T.,.F.)
aDatiDisp[1][2]:= IIF(SubStr(DO->l_lun, 2, 1)="S",.T.,.F.)
aDatiDisp[1][3]:= IIF(SubStr(DO->l_lun, 3, 1)="S",.T.,.F.)
aDatiDisp[1][4]:= IIF(SubStr(DO->l_lun, 4, 1)="S",.T.,.F.)
aDatiDisp[1][5]:= IIF(SubStr(DO->l_lun, 5, 1)="S",.T.,.F.)
aDatiDisp[1][6]:= IIF(SubStr(DO->l_lun, 6, 1)="S",.T.,.F.)
aDatiDisp[1][7]:= IIF(SubStr(DO->l_lun, 7, 1)="S",.T.,.F.)
aDatiDisp[1][8]:= IIF(SubStr(DO->l_lun, 8, 1)="S",.T.,.F.)
aDatiDisp[1][9]:= IIF(SubStr(DO->l_lun, 9, 1)="S",.T.,.F.)
aDatiDisp[1][10]:= IIF(right(DO->l_lun, 1) ="S",.T.,.F.)



and then I made the same xbrowse of Nages



@ 3, 5 XBROWSE oLbx SIZE -10,-10 PIXEL OF oFld:adialogs[2] ;
DATASOURCE aData AUTOCOLS ;
HEADERS "Giorni" ;
LINES NOBORDER

for n := 2 to Len( oLbx:aCols )
WITH OBJECT oLbx:aCols[ n ]
:cHeader := LTrim( Str( n - 1 ) )
:SetCheck( { "CHECK2", "CHECK3" }, .t. )
END
next
WITH OBJECT oLbx
:lHScroll := :lVScroll := :lRecordSelector := .f.
:nWidths := 30
:nStretchCol := 1
//
:CreateFromCode()
END


@ 155, 88 BUTTON oBtn PROMPT "&Conferma" OF oDlg SIZE 40, 10 PIXEL FONT oFont DEFAULT ACTION ( oDlg:end( IDOK ) )
@ 155, 138 BUTTON oBtn PROMPT "&Annulla" OF oDlg SIZE 40, 10 PIXEL FONT oFont CANCEL ACTION ( oDlg:end( IDCANCEL ) )


ACTIVATE DIALOG oDlg

if oDlg:nresult == IDOK


//here all replaces

endif



but then the application crashed and I not Know why



Code: Select all  Expand view



Firma problema:
  Nome evento problema: APPCRASH
  Nome applicazione:    Orario.Exe
  Versione applicazione:    0.0.0.0
  Timestamp applicazione:   00000000
  Nome modulo con errori:   Orario.Exe
  Versione modulo con errori:   0.0.0.0
  Timestamp modulo con errori:  00000000
  Codice eccezione: c0000005
  Offset eccezione: 000b5808
  Versione SO:  6.1.7600.2.0.0.768.3
  ID impostazioni locali:   1040
  Informazioni aggiuntive 1:    602d
  Ulteriori informazioni 2: 602d728da428a661a671318696319515
  Ulteriori informazioni 3: 95c3
  Ulteriori informazioni 4: 95c393e65b974f88ec22ffac22206036
 
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: To Nages : How change an value on an array

Postby ukoenig » Fri Aug 17, 2012 8:08 pm

Silvio,

You can convert the logical vars.

I changed to

:SetCheck( { cBmpYes, cBmpNo }, .T. )

from :

// :bPaintText := { | oCol, hDC, cData, aRect, aColors, lHighLite | ;
// DrawCell( oCol, nCol, hDC, cData, aRect, aColors, lHighLite ) }

Image

Load from a DBF-Record and build the Array :

Code: Select all  Expand view

FUNCTION LOAD_PROJ()

aData := Array( nGRows, nGCols )

nCol := 1
nRow := 1

aData[ 1, 1 ] :=  ' Lunedi'
aData[ 2, 1 ] :=  ' Mercoledi'
aData[ 3, 1 ] :=  ' Mercoledi'
aData[ 4, 1 ] :=  ' Giovedi'
aData[ 5, 1 ] :=  ' Venerdi'
aData[ 6, 1 ] :=  ' Sabato'

FOR n := 1 to nGRows
    I := 1
    FOR I := 1 TO 10
        IF lUseDBF = .T.
            DBSELECTAREA(1)
            IF nRow = 1
                IF SUBSTR( (1)->L_LUN, I, 1) = "S"
                    aData[ nRow, I+1 ] := .T.
                ELSE
                    aData[ nRow, I+1 ] := .F.
                ENDIF
            ENDIF
            IF nRow = 2
                IF SUBSTR( (1)->L_MAR, I, 1) = "S"
                    aData[ nRow, I+1 ] := .T.
                ELSE
                    aData[ nRow, I+1 ] := .F.
                ENDIF
            ENDIF
            IF nRow = 3
                IF SUBSTR( (1)->L_MER, I, 1) = "S"
                    aData[ nRow, I+1 ] := .T.
                ELSE
                    aData[ nRow, I+1 ] := .F.
                ENDIF
            ENDIF
            IF nRow = 4
                IF SUBSTR( (1)->L_GIO, I, 1) = "S"
                    aData[ nRow, I+1 ] := .T.
                ELSE
                    aData[ nRow, I+1 ] := .F.
                ENDIF
            ENDIF
            IF nRow = 5
                IF SUBSTR( (1)->L_VEN, I, 1) = "S"
                    aData[ nRow, I+1 ] := .T.
                ELSE
                    aData[ nRow, I+1 ] := .F.
                ENDIF
            ENDIF
            IF nRow = 6
                IF SUBSTR( (1)->L_SAB, I, 1) = "S"
                    aData[ nRow, I+1 ] := .T.
                ELSE
                    aData[ nRow, I+1 ] := .F.
                ENDIF
            ENDIF
        ELSE
            aData[ nRow, I+1 ] := .T.
        ENDIF
    NEXT
    nRow++
NEXT n

RETURN( aData )
 


On Cellclick :

Code: Select all  Expand view

     oLbx1:bLClicked := { | nRow, nCol | nRPos := oLbx1:KeyNo(), ;
     nCPos := oLbx1:SelectedCol():nCreationOrder, ;
     SAVE_DATA(aData) }
 


Save and convert the logical Return-values to a DBF-record ( Mouseclick on Cell )

Code: Select all  Expand view

FUNCTION SAVE_DATA(aData)
LOCAL n := 0, nCol := 1, cStatus := "", nRow := 1, cNew0 := "", cNew1 := "", lFound := .F.

FOR n := 1 to nGCells ( 6 x 10 )
    lFound := .F.
    IF nCol > 1
        IF nRow = nRPos .and. nCol = nCPos
            IF aData[ nRow, nCol ] = .T.
                aData[ nRow, nCol ] := .F.
                cStatus := "N"
            ELSE
                aData[ nRow, nCol ] := .T.
                cStatus := "S"
            ENDIF
            lFOund := .T.
        ENDIF
    ENDIF

    IF lFound = .T.
        DBSELECTAREA(1)
        IF RLOCK()
            IF nRecPos >= 0 .and. nRecPos <= 11
                cNew0 := (1)->L_LUN
                cNew1 := STUFF( cNew0, nCol - 1, 1, cStatus )
                (1)->L_LUN := cNew1
            ENDIF
            IF nRecPos >= 10 .and. nRecPos <= 21
                cNew0 := (1)->L_MAR
                cNew1 := STUFF( cNew0, nCol - 1, 1, cStatus  )
                (1)->L_MAR := cNew1
            ENDIF   
            IF nRecPos >= 20 .and. nRecPos <= 31
                cNew0 := (1)->L_MER
                cNew1 := STUFF( cNew0, nCol - 1, 1, cStatus  )
                (1)->L_MER := cNew1
            ENDIF      
            IF nRecPos >= 30 .and. nRecPos <= 41
                cNew0 := (1)->L_GIO
                cNew1 := STUFF( cNew0, nCol - 1, 1, cStatus  )
                (1)->L_GIO := cNew1
            ENDIF
            IF nRecPos >= 40 .and. nRecPos <= 51
                cNew0 := (1)->L_VEN
                cNew1 := STUFF( cNew0, nCol - 1, 1, cStatus  )
                (1)->L_VEN := cNew1
            ENDIF      
            IF nRecPos >= 50
                cNew0 := (1)->L_SAB
                cNew1 := STUFF( cNew0, nCol - 1, 1, cStatus  )
                (1)->L_SAB := cNew1
            ENDIF
            DBUNLOCK()
        ENDIF
    ENDIF
    nCol++
    IF nCol > nGCols
        nRow++
        nCol := 1
    ENDIF
    IF nRow > nGRows
        EXIT
    ENDIF
NEXT n

RETURN NIL
 


Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: To Nages : How change an value on an array

Postby Eoeo » Fri Aug 17, 2012 8:44 pm

Now Perhaps I resolve but only on a test tomorrow I must insert all on application and I say you if I resolved
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: To Nages : How change an value on an array

Postby nageswaragunupudi » Sat Aug 18, 2012 1:47 am

You can directly browse the DBF without having to read into an array.
Code: Select all  Expand view
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"
#include "hbcompat.ch"

REQUEST DBFCDX

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

function Main()

   LOCAL oDlg, oBrw, oFont, n

   CreateTestDBF()

   USE TESTDBF SHARED
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 700,300 PIXEL FONT oFont
   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE "TESTDBF" ;
      COLUMNS "PROJECT" ;
      CELL LINES NOBORDER

   for n := 1  to 10
      AddBrwCol( oBrw, 2, n )
   next

   WITH OBJECT oBrw
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

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

static function AddBrwCol( oBrw, nFld, nCol )

   local oCol, c

   WITH OBJECT ( oCol := oBrw:AddCol )
      :cHeader    := Str( nCol, 1 )

      :bEditValue    := { || If( ( c := ( oBrw:cAlias )->( FieldGet( nFld ) )[ nCol ] ) == 'S', .t., ;
                             If( c == 'N', .f., nil ) ) }

      :bOnPostEdit   := { |o,x| ( oBrw:cAlias )->( If( RLock(), ;
         ( c  := FieldGet( nFld ), c[ nCol ] := If( x, 'S', 'N' ), FieldPut( nFld, c ) ), nil ),  ;
         DbUnlock() ) }

      :SetCheck( { "bitmaps\ok_32.bmp", "bitmaps\no_32.bmp", "bitmaps\question.bmp" }, .t. )
   END

return nil

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

static function CreateTestDbf()

   local aCols := { { "PROJECT", 'C', 10, 0 }, { "L_LUNA", 'C', 10, 0 }, ;
                    { "L_MAR", 'C', 10, 0 } }

   if .t. // ! File( "TESTDBF.DBF" )
      DBCREATE( "TESTDBF", aCols )
      USE TESTDBF EXCLUSIVE
      APPEND BLANK
      FIELD->PROJECT    := "Lunedi"
      FIELD->L_LUNA     := "NNNNNSSSSS"
      FIELD->L_MAR      := "SNNNSNSNSS"
      APPEND BLANK
      FIELD->PROJECT    := "Martedi"
      FIELD->L_LUNA     := "SSSNNSXSNN"
      FIELD->L_MAR      := "NNNSSSNNNN"
      APPEND BLANK
      FIELD->PROJECT    := "Mercoledi"
      FIELD->L_LUNA     := "NXNSSSXSSS"
      FIELD->L_MAR      := "SNNNSNSNSS"
      APPEND BLANK
      FIELD->PROJECT    := "Giovedi"
      FIELD->L_LUNA     := "SSSNNSSSSS"
      FIELD->L_MAR      := "SNNNSNSNSS"
      APPEND BLANK
      FIELD->PROJECT    := "Venerdi"
      FIELD->L_LUNA     := "NNNNNSSSSS"
      FIELD->L_MAR      := "SNNNSNSNSS"
      USE
   endif

return nil

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

The sample shows how to use a 3rd bitmap when the value is neither true nor false.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: To Nages : How change an value on an array

Postby Eoeo » Sat Aug 18, 2012 3:39 pm

NAGES YOU'RE FANTASTIC

the test run ok
ONLY WHEN i CLICK ON A CELLi CAN CHECK ONLY GREEN OR RED BITMAP AND NOT ALSO QUESTION .BMP !!!


But return on my question I need this configuration of Dbf


local aCols := { { "PROJECT", 'C', 10, 0 } , ;
{"l_lun ", "c", 10, 0}, ;
{"l_mar ", "c", 10, 0}, ;
{"l_mer ", "c", 10, 0}, ;
{"l_gio ", "c", 10, 0}, ;
{"l_ven ", "c", 10, 0}, ;
{"l_sab ", "c", 10, 0} }



if .t. // ! File( "TESTDBF.DBF" )
DBCREATE( "TESTDBF", aCols )
USE TESTDBF EXCLUSIVE
APPEND BLANK
FIELD->PROJECT := "Teacher"

FIELD->l_lun := "NNNNNSSSSS" // monday
FIELD->l_mar := "SNNNSNSNSS" //Tuesday
FIELD->l_mer := "NNNNNSSSSS" // Wednesday
FIELD->l_gio := "SNNNSNSNSS" // Thursday
FIELD->l_ven := "SNNNSNSNSS" // Friday
FIELD->l_sab := "SNNNSNSNSS" // saturday
USE
endif

return nil

I use this configuration to set for each teacher ( from hour 1 to hour 10) the reservation for that day


I wish a xbrowse with

days 1 2 3 4 5 6 7 8 9 10 <--- header
-------------------------------------------------------------------------------
monday |
Tuesday |
Wednesday |
Thursday |
Friday |
saturday |
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: To Nages : How change an value on an array

Postby ukoenig » Sun Aug 19, 2012 10:49 am

Supporting Silvio's DBF-structure,
many new Functions are included :

I changed ( possible, to show ANY defined Image ) :

:bPaintText := { | oCol, hDC, cData, aRect, aColors, lHighLite | ;
DrawCell( oCol, nCol, hDC, cData, aRect, aColors, lHighLite ) }


To ( 2 way Status ) :

:SetCheck( { cBmpYes, cBmpNo, cBmpHelp }, .T. )

Download :
http://www.pflegeplus.com/fw_downloads/xBrwimg3.zip

1. Load Vars from a Record and switch / display Values on Folderpage1 in Image-mode
2. Change Fields of a selected Record using a combobox splitting the selected Field
( changing value in Textmode )
3. The selected Record-pos is saved to a INI, and will be displayed at new Start.

I want to keep this as a Sample. More Improvements will be thankful adopted.

Maybe we still can include the desired third BMP ( YES / NO is used for the moment ) ?

Image

1. Button < Clear Grid > replaces the 10 Fields and 6 Days with "SSSSSSSSSS"
2. Define, if only 1 Cellchange is allowed ( old Values are replace with "S" ) or multiple changes.
3. There are 2 ways, changing a Project :
3a ) From inside the 1. Page, You can skip through the different Records
3b ) From inside the 2, Page, You can select from the DBF-overview.

Image

Best Regards
Uwe :lol:
Last edited by ukoenig on Sun Aug 19, 2012 9:45 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: To Nages : How change an value on an array

Postby Eoeo » Sun Aug 19, 2012 5:00 pm

Uwe,
please see attention to Nages Last Test
I tink it can be modify it easy
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: To Nages : How change an value on an array

Postby ukoenig » Sun Aug 19, 2012 5:33 pm

Silvio,

the usage of the DBF-structure is complete different :

There is the Reason, for all the needed calculations to keep Your existing DBF-structure.
I*m building a ARRAY from 1 Record like :

Image

I'm using Your Project-dbf : 1 Record = 1 Project ( Teacher )
{ "PROJECT", 'C', 10, 0 }, ;
{ "L_LUN", 'C', 10, 0 }, ;
{ "L_MAR", 'C', 10, 0 }, ;
{ "L_MER", 'C', 10, 0 }, ;
{ "L_GIO", 'C', 10, 0 }, ;
{ "L_VEN", 'C', 10, 0 }, ;
{ "L_SAB", 'C', 10, 0 } }

I := 1
FOR I := 1 TO 5 // 5 Project Records defined
DBAPPEND ()
IF RLOCK()
(1)->SELECT := "Select " + ALLTRIM(STR(I))
(1)->L_LUN := "SSSSSSSSSS"
(1)->L_MAR := "SSSSSSSSSS"
(1)->L_MER := "SSSSSSSSSS"
(1)->L_GIO := "SSSSSSSSSS"
(1)->L_VEN := "SSSSSSSSSS"
(1)->L_SAB := "SSSSSSSSSS"
DBUNLOCK()
ENDIF
NEXT

Mr. Rao uses the Structure like :

Lunedi--12345678910
Append
Mercoledi--12345678910
Append...
...
{ "PROJECT", 'C', 10, 0 }, ;
{ "L_LUN", 'C', 10, 0 }, ;
{ "L_MAR", 'C', 10, 0 }, ;
{ "L_MER", 'C', 10, 0 }, ;
{ "L_GIO", 'C', 10, 0 }, ;
{ "L_VEN", 'C', 10, 0 }, ;
{ "L_SAB", 'C', 10, 0 } }

6 Records are used for 1 Project.

APPEND BLANK
FIELD->PROJECT := "Lunedi"
FIELD->L_LUN := "NNNNNSSSSS"
FIELD->L_MAR := "SNNNSNSNSS"
FIELD->L_MER := "SNXNSNSNSS"
FIELD->L_GIO := "SNNNSNSNSS"
FIELD->L_VEN := "SNSNSNSNSS"
FIELD->L_SAB := "SNNNSNSNSS"
APPEND BLANK
FIELD->PROJECT := "Martedi"
FIELD->L_LUN := "NNNNNSSSSS"
FIELD->L_MAR := "SNNNSNSNSS"
FIELD->L_MER := "SNXNSNSNSS"
FIELD->L_GIO := "SNNNSNSNSS"
FIELD->L_VEN := "SNSNSNSNSS"
FIELD->L_SAB := "SNNNSNSNSS"
...
...
...
Maybe it is possible, to change this.

Best Regards Uwe :lol:
Last edited by ukoenig on Sun Aug 19, 2012 9:46 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: To Nages : How change an value on an array

Postby Eoeo » Sun Aug 19, 2012 6:47 pm

Dear Uwe,

Dear Nages

You must believe me I can not change the configuration of the archive,

is an old application should change millions of lines of code for these changes,

wbrowse everything was easy because the conversion to be difficult?


Structure of archive


Code: Select all  Expand view


dbcreate(cDir+'Ana',;
        {{"cognome   ", "c", 25, 0}, ;
         {"nome      ", "c", 25, 0},;
         {"giornoli  ", "c", 1, 0}, ;
         {"oredispo  ", "c", 1, 0}, ;
         {"orecatt   ", "c", 2, 0}, ;
         {"scudes1   ", "c", 30, 0},;
         {"scu1      ", "n", 2, 0}, ;
         {"scudes2   ", "c", 30, 0},;
         {"scu2      ", "n", 2, 0}, ;
         {"Max_ore   ", "c", 1, 0}, ;
         {"Min_ore   ", "c", 1, 0}, ;
         {"Max_buche ", "c", 1, 0}, ;
         {"Min_buche ", "c", 1, 0}, ;
         {"punti     ", "c", 1, 0}, ;
         {"l_lun    ", "c", 10, 0}, ;
         {"l_mar    ", "c", 10, 0}, ;
         {"l_mer    ", "c", 10, 0}, ;
         {"l_gio    ", "c", 10, 0}, ;
         {"l_ven    ", "c", 10, 0}, ;
         {"l_sab    ", "c", 10, 0}}, 'DBFCDX' )


 












( Wbrowse)

Code: Select all  Expand view


 twbrowse():lVscroll:=.f.
 twbrowse():lhscroll:=.f.

   @ 1, 6 LISTBOX oLbx FIELDS HEADER "","1","2","3","4","5","6","7","8","9","10" ;
              SIZE 202,113 pixel OF oFld:adialogs[2]  UPDATE   ;
              SIZES 55, 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() )




                  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:nHeaderHeight  := 20
       oLbx:nLineHeight  :=  32
       oLbx:nFreeze:=11
       oLbx:lAdjBrowse:=.F.
       oLbx:lCellStyle  := .T.
       oLbx:aHJustify :={2,2,2,2,2,2,2,2,2,2,2 }
       oLbx:lVscroll:=.F.
       oLbx:lhscroll:=.F.


 
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: To Nages : How change an value on an array

Postby ukoenig » Sun Aug 19, 2012 7:16 pm

Silvio,

what is the fieldname from Your DBF, You are using for the Teachername,
or another Field, that makes a Record different ?

Teacher-field ?
{"l_lun ", "c", 10, 0}, ;
{"l_mar ", "c", 10, 0}, ;
{"l_mer ", "c", 10, 0}, ;
{"l_gio ", "c", 10, 0}, ;
{"l_ven ", "c", 10, 0}, ;
{"l_sab ", "c", 10, 0}}, 'DBFCDX' )

Best Regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: To Nages : How change an value on an array

Postby Eoeo » Sun Aug 19, 2012 9:59 pm

dbcreate(cDir+'Ana',;
{{"cognome ", "c", 25, 0}, ; Surname
{"nome ", "c", 25, 0},; Name
{"giornoli ", "c", 1, 0}, ; free day
{"oredispo ", "c", 1, 0}, ; reservation hour
{"orecatt ", "c", 2, 0}, ; lesson hour
{"scudes1 ", "c", 30, 0},; school
{"scu1 ", "n", 2, 0}, ;
{"scudes2 ", "c", 30, 0},; school
{"scu2 ", "n", 2, 0}, ;
{"Max_ore ", "c", 1, 0}, ; Max hours
{"Min_ore ", "c", 1, 0}, ;
{"Max_buche ", "c", 1, 0}, ; Max reservation
{"Min_buche ", "c", 1, 0}, ; Min reservation
{"punti ", "c", 1, 0}, ; points
{"l_lun ", "c", 10, 0}, ; monday
{"l_mar ", "c", 10, 0}, ;
{"l_mer ", "c", 10, 0}, ;
{"l_gio ", "c", 10, 0}, ;
{"l_ven ", "c", 10, 0}, ;
{"l_sab ", "c", 10, 0}}, 'DBFCDX' ) saturday
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 43 guests