Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change Value of chkBox in Grid
Message
 
 
To
21/11/2002 14:56:09
General information
Forum:
Visual FoxPro
Category:
CodeMine
Miscellaneous
Thread ID:
00725392
Message ID:
00725440
Views:
9
Gary,

>Are you saying that the above code does or does not actually work?<

Yes, it does actually change the chkBox to True as required, because the Save button is then pushable. As soon as I press Save the chkbox reflects that, but not before. Or, as soon as I move off that row - the chkbox reflects the change, but Save is still pushable.

>The thing that stands out to me here is that you are trying to affect the appearance/behaviour of the non-active cell.<

True - the only purpose of the grid is to scroll through a grid with 4 columns, and set a chkBox to true or false. Some of these grids might have 500 records, and I give user's the option of either mousing the check box, or pressing Enter cause they are already incrementing anyway with the keyboard.

>In a grid, the only cell that is active is the one you are actually in at the moment (unlike, say, a spreadsheet). I assume that your grid is bound to a data source? <

Yes

>You must remember that when a column's "sparse" property is set False, Codemine's enhanced data binding is turned "off". Codemine controls usually require Sparse set True to work as you expect. This, however, is not possible when using a checkbox in a grid.<

Right, I found this out.

>It might be worth trying to replace the checkbox's control source with the appropriate value (as opposed to calling the control's SetValue() method)<

You mean using the replace command? You saying that - made me think of the following.....

I just added the following THISFORM.Save() and it does the trick. You think that would be a problem doing something like:
LPARAMETERS nKeyCode, nShiftAltCtrl
IF m.nKeyCode = 13
* Gary, is there a way to check for a value like this - but the 
* following doesn't work correctly. However, I would prefer to do
* it like this if I could:
*	IF THIS.PARENT.PARENT.COLumn4.CHkcheckboxcustom1.VALUE = 0
* Or do I have to check the actual table like the following - as
* this works perfectly:
	IF MyGridTable.wk01 = 0
		THIS.PARENT.PARENT.COLumn4.CHkcheckboxcustom1.SetValue(1)
	ELSE
		THIS.PARENT.PARENT.COLumn4.CHkcheckboxcustom1.SetValue(0)
	ENDIF
	THIS.PARENT.PARENT.Column4.Chkcheckboxcustom1.REFRESH()
** Gary - I added the following Save().
        THISFORM.Save('MyGridTable')

	NODEFAULT
ELSE
	DODEFAULT(nKeyCode, nShiftAltCtrl)
ENDIF
This save's the change immediately, and updates the chkBox. This is not really a problem, because if they press Enter again, I added code to uncheck the chkBox. What you think?

Mel Cummings
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform