Page 1 of 1

Help with reading contents of a grid cell

Posted: Sun Mar 11, 2018 5:45 am
by bluebird
Dear Friends od g HMG

I have so much to learn. Recent problem is failure to read contents of a GRID that has been loaded with numbers

I have tried the following code to GET the values off the grid but they return Nils even though I can see the real
values by clicking on the cells.

The grid and the code to read values are shown below. As you can see I have tried different ways for b and c to no avail.

cimage is the name of an image control like cImage:="ImageNo"+str(nImageNo,1)

b:= setproperty("Win_2",cImage,"row",Getproperty("Full_Composite_Image","Grid_Assignment","value(nI,3)"))
c:= setproperty("Win_2",cImage,"col",Getproperty("Full_Composite_Image","Grid_Assignment","cellex(nI,3)"))

msgdebug("What is the values of a and b",a,b) // returns NIl,Nil



DEFINE GRID Grid_Assignment
ROW 120
COL 230
WIDTH 290
HEIGHT 340
VALUE Nil
WIDTHS {40,55,55,70,70 }
HEADERS {"Img","Row","Col","Width","Height"}
FONTNAME "Arial"
FONTSIZE 11
TOOLTIP ""
ONCHANGE Nil
ONGOTFOCUS Nil
ONLOSTFOCUS Nil
FONTBOLD .T.
ONDBLCLICK Nil
MULTISELECT .F.
ALLOWEDIT .T.
VIRTUAL .F.
DYNAMICBACKCOLOR Nil
DYNAMICFORECOLOR Nil
COLUMNWHEN Nil
COLUMNVALID Nil
COLUMNCONTROLS Nil
SHOWHEADERS .T.
CELLNAVIGATION .T.
NOLINES .F.
HELPID Nil
IMAGE Nil
JUSTIFY Nil
ITEMCOUNT MAXIMAGES
BACKCOLOR {192,192,192}
FONTCOLOR {0,193,97}
HEADERIMAGES Nil
ROWSOURCE Nil
COLUMNFIELDS Nil
ALLOWAPPEND .F.
ALLOWDELETE .F.
BUFFERED .F.
DYNAMICDISPLAY Nil
ONSAVE Nil
LOCKCOLUMNS 0
END GRID
Thanks for looking at my post

Re: Help with reading contents of a grid cell

Posted: Sun Mar 11, 2018 10:36 am
by edk
Try:

Code: Select all

b := setproperty ( "Win_2" , cImage , "row" , Getproperty ( "Full_Composite_Image" , "Grid_Assignment" , "value" , nI , 3 ) )
c := setproperty ( "Win_2" , cImage , "col" , Getproperty ( "Full_Composite_Image" , "Grid_Assignment" , "cellex" , nI , 3 ) )

Re: Help with reading contents of a grid cell

Posted: Mon Mar 12, 2018 6:37 pm
by bluebird
The solution for memvar c:=Getproperty ( "Full_Composite_Image" , "Grid_Assignment" , "cellex" , nI , 3 ) worked very well thanks edk

New surprise though! If I load the grid with sets of numeric memvars then use
Getproperty ( "Full_Composite_Image" , "Grid_Assignment" , "cellex" , nI , 3 ) )

I get back character values instead of the numeric ones that I loaded.

Can anyone explain why, and how I can get back the numbers instead of characters?

Thanks

Re: Help with reading contents of a grid cell

Posted: Tue Mar 13, 2018 12:22 pm
by koke
you only want what's on each cell
have you try
theline := Win_2.Grid_Assignment.item(Win_2.Grid_Assignment.value)
it returns an array with the values of each row, and it doesent matters whitch type they are.