Enable / disable checkboxes per line in a grid control

This question is answered

Hi Guys,

  Is it possible to enable / disable checkboxes per line in a grid control?  I'm trying to setup some code in a form or form datasource which will disable a checkbok in once column of the line when another checkbox is ticked.  If I do something like the following it toggles the entire column of the grid not the specific line I'm on:

     smaServiceOrderLine_ds.object(fieldNum(SMAServiceOrderLine, GridLine_SignOff)).allowEdit(!SMAServiceOrderLine.Nob_Estimate);

Same deal if I try and do it this way

    GridLine_SignOff.enabled(!SMAServiceOrderLine.Nob_Estimate);

Has anyone else done something along these lines (no pun intended) before?

Thanks

David

Verified Answer
  • David

    Though I maybe wrong, I don't think that you can change the state of a field inside a grid per line.

    If you call the code that you wrote above each time the focus changes to a different line (I think calling it from the active method on the datasource would do the trick) as well as when the user toggles the checkbox, I think you would get a similar effect.

    Regards,

    Ryuji

All Replies
  • David

    Though I maybe wrong, I don't think that you can change the state of a field inside a grid per line.

    If you call the code that you wrote above each time the focus changes to a different line (I think calling it from the active method on the datasource would do the trick) as well as when the user toggles the checkbox, I think you would get a similar effect.

    Regards,

    Ryuji

  • Thanks Ryuji,

      I think you might be right that its not possible.  Unless anyone else offers a solution I think I might need to do something else.  Perhaps put a clicked method on the checkbox itself to check if the conditions are valid to allow the change.  I could also put something in the validiatewrite method of the table to prevent invalid selections.

    Cheers

    David.