* * *

Author Topic: TValueListEditor with checkbox  (Read 1149 times)

aducom

  • Jr. Member
  • **
  • Posts: 96
    • http://www.aducom.com
TValueListEditor with checkbox
« on: June 26, 2018, 05:30:39 pm »
Does anyone found a good solution here? Unfortunately the component is not using the columns property and therefore it's less obvious then I thought it would be.

wp

  • Hero Member
  • *****
  • Posts: 4916
Re: TValueListEditor with checkbox
« Reply #1 on: June 26, 2018, 06:00:58 pm »
I thinks the easiest solution is to switch to a TStringGrid with two columns.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Bart

  • Hero Member
  • *****
  • Posts: 3102
    • Bart en Mariska's Webstek
Re: TValueListEditor with checkbox
« Reply #2 on: June 26, 2018, 07:43:57 pm »
Override TValueListEditor.GetDefaultEditor(Column: Integer)?

Bart

aducom

  • Jr. Member
  • **
  • Posts: 96
    • http://www.aducom.com
Re: TValueListEditor with checkbox
« Reply #3 on: June 26, 2018, 07:49:47 pm »
Thanks Bart and WP.

Both are good options! Overriding sounds as the least work, at least for now so I'll start with that.

b.r. ALbert

wp

  • Hero Member
  • *****
  • Posts: 4916
Re: TValueListEditor with checkbox
« Reply #4 on: June 26, 2018, 07:58:03 pm »
Override TValueListEditor.GetDefaultEditor(Column: Integer)?
I tried it, does not work. TValueListEditor overrides the cell editor mechanism because it mimics the grid columns by introducing so-called ItemProps with which you can select for example a picklist editor, but no checkbox editor, unfortunately. The implemented "EditStyles" are TEditStyle = (esSimple, esEllipsis, esPickList). I wonder why the author of the component did not think of a checkbox (maybe it was written before checkboxes were added to the ObjectInspector?). It's probably not too difficult to add it. Unfortunately I don't have the time now.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Bart

  • Hero Member
  • *****
  • Posts: 3102
    • Bart en Mariska's Webstek
Re: TValueListEditor with checkbox
« Reply #5 on: June 26, 2018, 10:47:19 pm »
TCustomGrid.EditorByStyle also does not seem to support checkboxes...

Bart

wp

  • Hero Member
  • *****
  • Posts: 4916
Re: TValueListEditor with checkbox
« Reply #6 on: June 26, 2018, 11:46:53 pm »
Ah, I confused it with the columns... There is a ButtonStyle with a checkbox (TColumnButtonStyle = (cbsAuto, cbsEllipsis, cbsNone, cbsPickList, cbsCheckboxColumn, cbsButton, cbsButtonColumn)), but this checkbox is a bit strange because it takes the entire column and does not allow text any more.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Bart

  • Hero Member
  • *****
  • Posts: 3102
    • Bart en Mariska's Webstek
Re: TValueListEditor with checkbox
« Reply #7 on: June 27, 2018, 08:38:54 am »
Why not use a checklistbox (if only checkboxes are needed)?

Bart

aducom

  • Jr. Member
  • **
  • Posts: 96
    • http://www.aducom.com
Re: TValueListEditor with checkbox
« Reply #8 on: June 27, 2018, 02:27:46 pm »
The valuelistbox is like the property editor, each line can have a different editor. But unlike in the stringgrid it makes no use of the columns and thus cbscheckbox column cannot be used. It's not implemented. only cbsauto, cbsEllipse and cbspicklist. That's why I asked. I found out that overriding did not work. I was requesting for options ;-)
I keep it for now as a cbspicklist with true/false. Once I have time I will see what would be the option. Fork the component? Or modify the existing one?

Bart

  • Hero Member
  • *****
  • Posts: 3102
    • Bart en Mariska's Webstek
Re: TValueListEditor with checkbox
« Reply #9 on: June 27, 2018, 04:54:09 pm »
Feel free to rewrite it so it uses columns and then submit a patch to the bugtracker.

Bart

aducom

  • Jr. Member
  • **
  • Posts: 96
    • http://www.aducom.com
Re: TValueListEditor with checkbox
« Reply #10 on: June 28, 2018, 08:23:07 pm »
Ah, that's the procudure. Ok. Tnx.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus