Page 2 of 2

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

Posted: Sun Aug 19, 2012 10:17 pm
by nageswaragunupudi
If you have a working wbrowse code, that can be converted straightforward. XBrowse code also is much similar. Here is a straight conversion of wbrowse code:

Code: Select all

function Main()

   local oDlg, oBrw, oFont, aData, n

   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","X","S" } ;
   }


   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 500,400 PIXEL FONT oFont
   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE aData AUTOCOLS ;
      HEADERS "", "1","2","3","4","5","6","7","8","9","10" ;
      SIZES 55, 35, 35, 35,35,35,35,35,35,35,35 ;
      CELL LINES NOBORDER ;
      ON DBLCLICK If( oBrw:nColSel > 1, ;
         ( oBrw:aRow[ oBrw:nColSel ] := ;
         If( oBrw:aRow[ oBrw:nColSel ] == 'S', 'N', 'S' ), ;
         oBrw:RefreshCurrent() ), nil )

   for n := 2 to 11
      WITH OBJECT oBrw:aCols[ n ]
         :bBmpData      := { |v| If( v == 'S', 1, If( v == 'N', 2, 3 ) ) }
         :bStrData      := { || nil }
      END
   next

   WITH OBJECT oBrw
      :AddBitmap( { "bitmaps\ok_32.bmp", "bitmaps\no_32.bmp", "bitmaps\question.bmp" } )
      :nRowHeight       := 35
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( oBrw:SetFocus(), .f. )
   RELEASE FONT oFont


return nil


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

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

Posted: Sun Aug 19, 2012 11:52 pm
by Eoeo
Yes now Run perfectly!!!

I wanted show for effect seven windows

Image



How activate the third element "X" for question.bmp ?

i F i CLICK ON ? ( BLUE BMP) i CAN INSERT ONLY GREEN OR RED BITMAP

I wish also reselect blue bitmap

I tried with
If( oBrw:aRow[ oBrw:nColSel ] == 'S', 'N', 'S' ), ;
If( oBrw:aRow[ oBrw:nColSel ] == 'X', 'S', 'X' ), ;
If( oBrw:aRow[ oBrw:nColSel ] == 'N', 'X', 'N' ), ;

but not run

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

Posted: Mon Aug 20, 2012 11:05 am
by ukoenig
Silvio,

You need a copy of the Image-array to check, if there the same selected Cellposition is YesBMP- or HelpBMP.
If it is HelpBMP, you must replace YesBMP in the Image-WorkArray with HelpBMP.
In my Test, I added a Switch, to change HelpBMP to YesBMP.
With lHelpBMP = .F., HelpBMP is used ( from saved Array ), otherwise YesBMP.
Because it is a Switch, You can select the HelpBMP's You want to change to YesBMP.

Image

Best Regards
Uwe :lol:

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

Posted: Mon Aug 20, 2012 1:11 pm
by nageswaragunupudi

Code: Select all

      ON DBLCLICK If( oBrw:nColSel > 1, ;
         ( oBrw:aRow[ oBrw:nColSel ] := ;
         If( oBrw:aRow[ oBrw:nColSel ] == 'S', 'N', ;
         If( oBrw:aRow[ oBrw:nColSel ] == 'N', 'X', 'S' ) ), ;
         oBrw:RefreshCurrent() ), nil )
 

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

Posted: Mon Aug 20, 2012 6:21 pm
by ukoenig
Mr. Rao,

Thank You very much for Your help.
It is tested and works fine.

Here is the Download-link for the complete new sample :
( 3 Click-solution to change a Image )

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

Image

Best Regards
Uwe :lol:

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

Posted: Mon Aug 20, 2012 8:12 pm
by Eoeo
Thanks Rao
Thanks Uwe
Now run ok on the test



But when I insert it on my application , the exe Crash ,and I not Know Why

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

Posted: Mon Aug 20, 2012 8:36 pm
by ukoenig
Silvio,

maybe a Var-problem ( Statics ) ?
Saving to a DBF can be shorter.
Function STUFF only needed, to save a single Char.

Code: Select all

FUNCTION SAVE_DATA()
LOCAL nCols := 2, cStatus := "", nRows := 1 

FOR nRows := 1 to nGRows // 6
    I := 2
    cStatus := ""
    FOR I := 2 TO 11
        cStatus := cStatus + aData[ nRows, I ] 
    NEXT
    // MsgAlert( "Row : " + ALLTRIM(STR(nRows)) + " => " + cStatus, "Row-string" )
    DBSELECTAREA(1)
    IF RLOCK()
        IF nRows = 1
            (1)->L_LUN := cStatus
        ENDIF
        IF nRows = 2
            (1)->L_MAR := cStatus
        ENDIF   
        IF nRows = 3
            (1)->L_MER := cStatus
        ENDIF       
        IF nRows = 4
            (1)->L_GIO := cStatus
        ENDIF
        IF nRows = 5
            (1)->L_VEN := cStatus
        ENDIF       
        IF nRows = 6
            (1)->L_SAB := cStatus
        ENDIF
        DBUNLOCK()
    ENDIF
NEXT nRows

RETURN NIL
 
Best Regards
Uwe :?: