ListBox and Xbrowse errors with array and bitmaps

ListBox and Xbrowse errors with array and bitmaps

Postby Eoeo » Sun Aug 12, 2012 7:15 pm

I have asmall error for a dialog with Listbox or a dialog with xbrowse

I explain

first I try with Listbox

Image

the final user must click on Hour from 1 to 10 to change the bitmap ( S or N )

if click on first column it must make any opertation

instead the procedure change the variable inserting S or N



@ 1, 6 LISTBOX oLbx FIELDS .....

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 );
} }









How I make to block the first column to change the data ?



Second Try with Xbrowse

I have the same table created with xbrowse

Image

here if I click over the second column ( for make a sample) the procedure change the bitmap into all row and not only on that cell as You can see on this another picture


Image


FOR i := 2 TO LEN(oLbx:aCols)
oCol := oLbx:aCols[ i ]
oCol:AddResource("CHECK2")
oCol:AddResource("CHECK3")
oCol:bBmpData := { || if(aData[oLbx:nArrayAt,2]=="S",1,2)}
oCol:bStrData := {|| NIL }
oCol:bLDClickData := { |r,c,f,o| o:Value := If( o:Value == 'S', 'N', 'S' ) }
NEXT




How I can resolve this problem ?

Someone can help me please ?
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: ListBox and Xbrowse errors with array and bitmaps

Postby Daniel Garcia-Gil » Sun Aug 12, 2012 8:36 pm

Try

oCol:bBmpData := { | u | u == "S", 1, 2 ) }
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: ListBox and Xbrowse errors with array and bitmaps

Postby Eoeo » Mon Aug 13, 2012 12:06 am

not run ok sorry
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: ListBox and Xbrowse errors with array and bitmaps

Postby ukoenig » Mon Aug 13, 2012 9:37 am

Do You need multiple selections or do You want to allow only 1 delete selection ?

With the Project-editor, it is easy, to create such a 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: ListBox and Xbrowse errors with array and bitmaps

Postby Eoeo » Mon Aug 13, 2012 2:40 pm

please Uwe,

I need only if the use click only a cell sample : Mercoledi 1

and if it is green it must become red or if it is red must become green

not all cells for that row


please use this test

Code: Select all  Expand view

#include "FiveWin.ch"
#include "xBrowse.ch"

#include "constant.ch"


Function Test()
   Local aDati [7]
   Local aDatiDisp[6,10]
   Local oLbx, aData
   Local oBmpYes := READBITMAP( 0, ".\BITMAPS\ok_32.BMP" )
   Local oBmpNO  := READBITMAP( 0, ".\BITMAPS\no_32.BMP" )
   Local agiorni :={"Lunedì","Martedì","Mercoledì","Giovedi","Venerdì","Sabato"}



   Local nBottom   := 22.4
   Local nRight    := 55
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H





    aDatiDisp[1][1]:= "S"
    aDatiDisp[1][2]:= "S"
    aDatiDisp[1][3]:= "S"
    aDatiDisp[1][4]:= "S"
    aDatiDisp[1][5]:= "S"
    aDatiDisp[1][6]:= "S"
    aDatiDisp[1][7]:= "S"
    aDatiDisp[1][8]:= "S"
    aDatiDisp[1][9]:= "S"
    aDatiDisp[1][10]:= "S"

   aDatiDisp[2][1]:= "S"
   aDatiDisp[2][2]:= "S"
   aDatiDisp[2][3]:= "S"
   aDatiDisp[2][4]:= "S"
   aDatiDisp[2][5]:= "S"
   aDatiDisp[2][6]:= "S"
   aDatiDisp[2][7]:= "S"
   aDatiDisp[2][8]:= "S"
   aDatiDisp[2][9]:= "S"
   aDatiDisp[2][10]:= "S"

   aDatiDisp[3][1]:= "S"
   aDatiDisp[3][2]:= "S"
   aDatiDisp[3][3]:= "S"
   aDatiDisp[3][4]:= "S"
   aDatiDisp[3][5]:= "S"
   aDatiDisp[3][6]:= "S"
   aDatiDisp[3][7]:= "S"
   aDatiDisp[3][8]:= "S"
   aDatiDisp[3][9]:= "S"
   aDatiDisp[3][10]:= "S"

   aDatiDisp[4][1]:= "S"
   aDatiDisp[4][2]:= "S"
   aDatiDisp[4][3]:= "S"
   aDatiDisp[4][4]:= "S"
   aDatiDisp[4][5]:= "S"
   aDatiDisp[4][6]:= "S"
   aDatiDisp[4][7]:= "S"
   aDatiDisp[4][8]:= "S"
   aDatiDisp[4][9]:= "S"
   aDatiDisp[4][10]:= "S"

   aDatiDisp[5][1]:= "S"
   aDatiDisp[5][2]:= "S"
   aDatiDisp[5][3]:= "S"
   aDatiDisp[5][4]:= "S"
   aDatiDisp[5][5]:= "S"
   aDatiDisp[5][6]:= "S"
   aDatiDisp[5][7]:= "S"
   aDatiDisp[5][8]:= "S"
   aDatiDisp[5][9]:= "S"
   aDatiDisp[5][10]:= "S"

   aDatiDisp[6][1]:= "S"
   aDatiDisp[6][2]:= "S"
   aDatiDisp[6][3]:= "S"
   aDatiDisp[6][4]:= "S"
   aDatiDisp[6][5]:= "S"
   aDatiDisp[6][6]:= "S"
   aDatiDisp[6][7]:= "S"
   aDatiDisp[6][8]:= "S"
   aDatiDisp[6][9]:= "S"
   aDatiDisp[6][10]:= "S"

    //data into aData array

   aData := { {'Lunedi',     aDatiDisp[1][1],aDatiDisp[1][2],aDatiDisp[1][3],aDatiDisp[1][4],aDatiDisp[1][5],aDatiDisp[1][6],aDatiDisp[1][7],aDatiDisp[1][8],aDatiDisp[1][9],aDatiDisp[1][10]},;
              {'Martedi',    aDatiDisp[2][1],aDatiDisp[2][2],aDatiDisp[2][3],aDatiDisp[2][4],aDatiDisp[2][5],aDatiDisp[2][6],aDatiDisp[2][7],aDatiDisp[2][8],aDatiDisp[2][9],aDatiDisp[2][10]},;
              {'Mercoledi',  aDatiDisp[3][1],aDatiDisp[3][2],aDatiDisp[3][3],aDatiDisp[3][4],aDatiDisp[3][5],aDatiDisp[3][6],aDatiDisp[3][7],aDatiDisp[3][8],aDatiDisp[3][9],aDatiDisp[3][10]},;
              {'Giovedi',    aDatiDisp[4][1],aDatiDisp[4][2],aDatiDisp[4][3],aDatiDisp[4][4],aDatiDisp[4][5],aDatiDisp[4][6],aDatiDisp[4][7],aDatiDisp[4][8],aDatiDisp[4][9],aDatiDisp[4][10]},;
              {'Venerdi',    aDatiDisp[5][1],aDatiDisp[5][2],aDatiDisp[5][3],aDatiDisp[5][4],aDatiDisp[5][5],aDatiDisp[5][6],aDatiDisp[5][7],aDatiDisp[5][8],aDatiDisp[5][9],aDatiDisp[5][10]},;
              {'Sabato',     aDatiDisp[6][1],aDatiDisp[6][2],aDatiDisp[6][3],aDatiDisp[6][4],aDatiDisp[6][5],aDatiDisp[6][6],aDatiDisp[6][7],aDatiDisp[6][8],aDatiDisp[6][9],aDatiDisp[6][10]} ;
           }













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

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



@ 3, 5 XBROWSE  oLbx OF oFld:adialogs[1] ;
      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:bBmpData := { | u | if(u == "S", 1, 2 ) }
     * oCol:bLDClickData  :=  { ||  (IIf( oLbx:SelectedCol():Value=="S",oLbx:SelectedCol():Value:="N",oLbx:SelectedCol():Value:="S"),oLbx:refresh())    }
      oCol:bClrSelFocus  := { || { CLR_BLACK, nRGB(202,224,252) } }
    * oCol:setcheck({"CHECK2","CHECK3"},)

      oCol:bLDClickData := { |r,c,f,o| o:Value := If( o:Value == 'S', 'N', 'S' ) }

    NEXT

   oLbx:CreateFromCode()




ACTIVATE DIALOG oDlg
 



I want click on only a cell and change the bitmap
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: ListBox and Xbrowse errors with array and bitmaps

Postby ukoenig » Tue Aug 14, 2012 9:29 am

Silvio,

I got it working (completely rewritten).
Another nice Sample for me.
With this Solution, You can also define, if You want to < Clean > the Arraylist,
before a NO-Image is displayed.
In this case only 1 NO-Image will be visible.

Download ( EXE and Source ) :
http://www.pflegeplus.com/fw_downloads/xBrwImg1.zip

Image

Extended Version : optional Gradient on 1. Column and Clear Array from old NO-Image

Image


Best Regards
Uwe :lol:
Last edited by ukoenig on Tue Aug 14, 2012 6:41 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: ListBox and Xbrowse errors with array and bitmaps

Postby ukoenig » Tue Aug 14, 2012 12:27 pm

Added a new Option :

lUseDBF := .T. // Load Cell-Status from DBF
lClean := .T. // Clear Cell of old NO-Images with .T. !!!
lGradient := .T. // gradient on 1. Column

Now it is possible (optional), to save the CELL-STATUS to a DBF
At new startup, the NO-Image(s) are shown

The incuded EXE-file shows a autodelete of the NO-Image ( lClean := .T. )
To activate the Click ON/OFF - option, You must set this Value to .F.
and recompile !!!.


Download Update ( EXE and Source ) :
http://www.pflegeplus.com/fw_downloads/xBrwImg1.zip

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: ListBox and Xbrowse errors with array and bitmaps

Postby Eoeo » Tue Aug 14, 2012 3:29 pm

Uwe,

I saw the first test
When The user click on a bitmap sample it become red
when the user click to another bitmap the old click must remain that of before it must not change

I hope you understood me


With Listbox ( wBrowse) run ok see it please

Image

When I click on another bitmap the procedure must not rechange the old bitmap

With this procedure I see if a Teacher want the day free or a secific hour on the morning , I must select one cell


i WANT ASK ANOTHER QUESTIONS


FIRST
this with two bitmap ( green and REd ) S and N

and If I want insert another data "?" with another bitmap ( help_32.bmp)

how I can make for create it ?



SECOND
then I saw your test and your dbf

I use another dbf with 6 field with ten characters into how you can see in this picture :



Image


then each data is call with

for a sample

I have a string SSSSSSNSSS

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

to determine if the CR is S or N AND POPULATE THE ARRAY
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: ListBox and Xbrowse errors with array and bitmaps

Postby ukoenig » Tue Aug 14, 2012 6:33 pm

Silvio,

When The user click on a bitmap sample it become red
when the user click to another bitmap the old click must remain that of before it must not change


this Option is included.
Just set < CLEAN > to .F. otherwise You will see only the new clicked Image
( Grid is cleaned from old selections ).
I added this option, because very often, only ONE selection is allowed.
You can test at Runtime using the RELAUNCH-button ( the selected Values are saved to a INI-file )
With < use DBF >, the last settings are saved to a DBF and loaded / displayed with a new start.

Download ( EXE and Source ) :

http://www.pflegeplus.com/fw_downloads/xBrwImg1.zip

Image

Best Regards
Uwe :?:
Last edited by ukoenig on Tue Aug 14, 2012 10:27 pm, edited 2 times 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: ListBox and Xbrowse errors with array and bitmaps

Postby Eoeo » Tue Aug 14, 2012 6:56 pm

Uwe,
the zip is the same of old !!!
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: ListBox and Xbrowse errors with array and bitmaps

Postby ukoenig » Tue Aug 14, 2012 7:34 pm

Silvio,
the Zip-file was updated, but here is a Download with another Name :

http://www.pflegeplus.com/fw_downloads/xBrwImg2.zip

Best Regards
Uwe :lol:
Last edited by ukoenig on Tue Aug 14, 2012 10:32 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: ListBox and Xbrowse errors with array and bitmaps

Postby Eoeo » Tue Aug 14, 2012 8:07 pm

uwe, it run ok but I must resolve it on my test sample
I have S and N
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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