To Nages : How change an value on an array

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post 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


//----------------------------------------------------------------------------//
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

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

Post 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
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

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

Post 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:
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
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post 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 )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

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

Post 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:
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
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

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

Post 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
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

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

Post 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 :?:
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.
Post Reply