Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
645
How to have text together with checkbox in one column?
posted

Good afternoon!

Is it possible to implement such a ultratree?

-[]SomeText1         SomeProperty1

      []SomeText2    SomeProperty2

     -[]SomeText3    SomeProperty3

         []SomeText4 SomeProperty4

Here '[]' means checkbox and '-' means expanded node.

I need this in an UltraTree with OutlookExpress ViewStyle.

In fact, when I use a column for checkbox, I am getting instead:

-[]        SomeText1 SomeProperty1

      []   SomeText2 SomeProperty2

     -[]   SomeText3 SomeProperty3

         []SomeText4 SomeProperty4

Thanks beforehand

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    This is a little bit tricky, because the cell in the tree can only store one piece of information (the text). So you need a place to store the state of the checkbox.

    The easiest things to do would be to add a separate CheckBox column to the tree and position it before the SomeText column.

    If you must have the checkbox in the same cell with the SomeText, then the easiest thing to do would be to use an UltraTextEditor. You still need the unbound column to store the data, but you could hide it.

    So what you would do is place an UltraTextEditor control on the form with your tree. Then use the ButtonsLeft property to add a StateEditorButton (which is a CheckBox).

    You attach the UltraTextEditor to the tree by setting the EditorComponent property of the column.

    To handle the retrieving and storing of the check state, you have to handle the InitializeEditorButtonCheckState and AfterEditorButtonCheckStateChanged respectively. These are events on the UltraTextEditor, but each event gives you an e.Context, which in this case will be the tree cell. From the cell, you can get to the row and from there, the other cells in the row, so you can access the hidden checkbox column.