---------
I'm having some trouble with the checkbox option for the tree gui.
After I add it using layout.SetLong('chck', LV_CHECKBOX);. It's greyed out and I can't click on it!?
Is there some flag that has to be set to allow the user change it?

BTW:
I do know how to change it depending on the type of object that's in the same cell. By using the overriden IsChecked() function. Like this:

The problem is I don't really understand the the logic of how these function pairs work:
SetCheck-ISChecked
Select-IsSelcted
Open-IsOpened
etc...

I've spent hours trying to understand what the heck this programmer was thinking. But I just can't figure out what he was thinking when he created this nightmare.

Using simple logic. You would logically think that we would use the Set,Select,Open functions to tell C4D to do something.
And you would logically think that the IsSet,IsSelected, IsOpen functions would act like receivers of those other functions. And react to them.
But no.........It's not working like that. And I can't for the life of me figure out what the heck the guy who wrote this thing was thinking.

IsChecked() is in charge of physically setting the checkbox to: enabled, checked, or neither
SetChecked() is the method that tells IsChecked what to do
So logically. You would get the current value of IsChecked() inside SetChecked(). And then make a decision what to do. And then tell IsChecked() what to do.
But there is no way I can find to make SetChecked() communicate with IsChecked()

In addition that.
If IsChecked() is not set to LV_CHECKBOX_ENABLED. Then you cannot use SetChecked() at all!?

Dammit! Don't got it.
That enables all the check boxes for all the tree items!

Why is this so difficult to do?
All I want to do is be able select a checkbox on each individual tree item. And when I do that, it makes the object in the same cell active.
Why is this such a huge massive thing to accomplish?

You can have multiple columns in a TreeViewCustomGui, these columns are specified by passing
a BaseContainer to TreeViewCustomGui::SetLayout(). The column parameter represents the column
the TreeView polls you for data. COLUMN_SELECTED served as an example, being a symbol for a
column of the TreeView. You need it to distinguish between the columns in the tree-view. Imagine
you have two columns in your tree-view that have a checkbox!

Originally posted by xxxxxxxx

The problem is I don't really understand the the logic of how these function pairs work:
SetCheck-ISChecked
Select-IsSelcted
Open-IsOpened
etc...

The documentation is quite concise about this. The TreeViewCustomGui polls your TreeViewFunctions
object for information. It asks "is the element selected?", "is the element opened (unfolded)?",
"is the checkbox checked?", etc.

Using simple logic. You would logically think that we would use the Set,Select,Open functions to tell C4D to do something.
And you would logically think that the IsSet,IsSelected, IsOpen functions would act like receivers of those other functions. And react to them.

No, in this case you are the one implementing that functionality. You must see it from the
perspective of the TreeViewCustomGui. Eg. if you were writing the TreeView, and you receive a
mouse event and come to the conclusion that an element was selected by the user, you'd do

The logic for this thing makes absolutely no sense at all to me.
This is why things need to documented properly, and clearly.

It is not the documentation that is lacking of information here. You are missing an important point.
You have one variable for all the elements in your tree-view. The change to that variable will affect
all checkboxes. Simple as that.

You usually store the data in the object that you use to represent your tree structure, the obj
parameter. In the example from my previous post, I demonstrated implementing the IsChecked()
method assuming you are representing a structure of BaseObjects.

This is a quite complete example. The whole thing is straight forward to implement. I have
written it from scratch and did not try to compile it, but it should serve its purpose of
demonstration very well.

Why is this so difficult to do?
All I want to do is be able select a checkbox on each individual tree item. And when I do that, it makes the object in the same cell active.
Why is this such a huge massive thing to accomplish?

See above, you can't store ONE value for MANY objects and expect it to work like that. (Maybe
looking at some data-relationship models might help you too).

Thanks for the effort Nik.
But I'm afraid that's not helping me figure out my checkbox problem.
I've learned a bit more about the tree gui over the past few days. And I think I've got a better understanding about how the two function pairs work together now.
I also understand how the columns work too.

But the thing I need (and don't understand) is how to make the checkboxes checkable by the user. So the user can select them individually.
I can check them all. But not individually.

You're checkbox code has problems in it that I don't understand how to fix:
COLUMN_HIDDEN: is Undefined <--- which .h file is this ID found?
COLUMN_SELECTED: is Undefined <--- which .h file is this ID found?
op->SetNBit(NBIT_OHIDE, control); <--- BaseObject has no such member?

Again. Just to clarify.
I just need to know how to make those checkboxes checkable. So the user can physically click on them individually. __So the user can click on them to turn them on/off.
That's all. No selecting, or hiding of anything in the tree, or the scene.
Your code for that has things in it that don't work for me. And I can't figure out how to change it so it works.

Thanks for the help,
-ScottA

*Edit- I don't know if this helps or not.
But I think what I'm looking for is the BIT code for the SetCheck() & IsChecked() functions so that The user can physically toggle the individual checkboxes on/off.

As I said before, COLUMN_SELECTED and COLUMN_HIDDEN are just some random symbols that should
identify your columns. Define them somewhere, whatever value you feel like.

Oops, you are right about the SetNBit() method, it is actually called ChangeNBit().

Originally posted by xxxxxxxx

I just need to know how to make those checkboxes checkable. So the user can physically click on them individually. So the user can click on them to turn them on/off. That's all. No selecting, or hiding of anything in the tree, or the scene.

Again Scott, you are using one single variable to save the state of many different checkboxes. But
what you need to do, is to store a variable per element. And this is usually done by storing the value
in the element itself (which is obj in IsChecked() or SetChecked()). A BaseObject has many different
bits and I just used one of them to represent the state of the checkbox.

Edit.
And COLUMN_SELECTED is supposed to be COLUMN_HIDDEN. Guess its better I write a complete
example

Ok. Thanks.
I see what you're doing by using the object now.
I don't really want to do that. But at least I see how it works now.
I will play around with it an see if I can store the bits someplace other than the objects.

Note: You've got IsChecked() set as a Bool type. But it needs to be a LONG type to compile (for me anyway)virtual LONG IsChecked(void* root, void* ud, void* obj, LONG column)

Thanks a lot for your help.
This has been driving me insane for the past three days.
I was close to going postal.