Author Topic: TreeViews and Checkboxes not working reliably.  (Read 375 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1422
  • Hero Points: 111
  • Text
TreeViews and Checkboxes not working reliably.
« on: June 07, 2017, 06:17:54 pm »
In the symhighlight code I've posted here I here a treeview with multiple check boxes per line.

Getting this to actually work took a bit of experimentation.
At first I thought it wouldn't work -- I could get multiple check boxes to appear on a line, but they wouldn't work correctly. This is why there are 3 implementations: Check boxes, Faking it with "[ ]/[X]" text, and Switches.

Eventually I found the trick. In setItemState() I set the state of each check box in right to left order. Setting them in left to right order doesn't work reliably.

Now I noticed though that symtag_clear_all_sym_highlights() doesn't update the dialog correctly ... only one of the "Enabled" check boxes gets cleared.

This function loops thru each highlight and calls _TreeSetCheckState() to uncheck the first checkbox on each line.

So far, I've not been able to make this work -- only one of them visually changes state.

I've verified that the code does actually call _TreeSetCheckState() to change the state of each of the check boxes. When I switch to my fake "CHECK_TEXTONLY" implementation, it works correctly.


I've tried a number of things, including splitting up that loop with _post_call(), and still no luck.

Whats going on?
Why are list boxes with checkboxes so unreliable?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4010
  • Hero Points: 265
Re: TreeViews and Checkboxes not working reliably.
« Reply #1 on: June 22, 2017, 01:20:12 am »
One limitation with check boxes is how a parent check box works. If all children are checked the parent must be checked. Not sure if that's the problem you are running into.

I tried using check boxes for something but realized that it wasn't possible due to how I wanted parent check boxes to work. I ended up doing something else.

Can you post a small sample?