FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To Nages : How change an value on an array
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: To Nages : How change an value on an array
Posted: Sun Aug 19, 2012 10:17 PM
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 (fw): Select all Collapse
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
Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: To Nages : How change an value on an array
Posted: Sun Aug 19, 2012 11:52 PM
Yes now Run perfectly!!!

I wanted show for effect seven windows





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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: To Nages : How change an value on an array
Posted: Mon Aug 20, 2012 11:05 AM
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.



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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: To Nages : How change an value on an array
Posted: Mon Aug 20, 2012 01:11 PM
Code (fw): Select all Collapse
      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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: To Nages : How change an value on an array
Posted: Mon Aug 20, 2012 06:21 PM
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



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.
Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: To Nages : How change an value on an array
Posted: Mon Aug 20, 2012 08:12 PM

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

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: To Nages : How change an value on an array
Posted: Mon Aug 20, 2012 08:36 PM
Silvio,

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

Code (fw): Select all Collapse
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.

Continue the discussion