To Nages : How change an value on an array

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

Postby nageswaragunupudi » 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: Select all  Expand view
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
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Eoeo » Sun Aug 19, 2012 11:52 pm

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

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

Postby ukoenig » 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.

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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

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

Postby nageswaragunupudi » Mon Aug 20, 2012 1:11 pm

Code: Select all  Expand view
     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
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby ukoenig » Mon Aug 20, 2012 6: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

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
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 » Mon Aug 20, 2012 8: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
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 » Mon Aug 20, 2012 8: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: Select all  Expand view

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

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 60 guests