Tree Ctrl

I would like to build Tree Control in MFC window just like SALOME, but i can't get the objects which i didn't select by mouse. it seems that there is some functions to manipulate objects selected by mouse,but there is no functions to manipulate objects which is not selected. So, when i want to get objects by choosing items in MFC Tree Ctrl, there is no function let me do that.
Who can help me?
Or there are some other ways to build Tree Ctrl.Just tell me.Thanks.

fhchina's picture

This problem is generally a MFC programming problem and NOT a OpenCascade programming problem. You can use HitTest of CTreeCtrl member function to get the corresponding HTREEITEM.

Where can I download the source or binary of SALOME? On its homepage I didn't find any thing which seems useful except some specification.

j-lin's picture

Thanks for your reply. I know how to build a Tree Control in MFC window,but the problem is that AIS_InteractiveContext object have some methods to manipulate objects that have selected by mouse,just like InitCurrent(),NextCurrent() and MoreCurrent(),but no methods to manipulate objects not selected.
so when i want to hit the items in TreeCtrl to get each objects(have been selected or not selected by mouse),it seems impossible.
so, Is there any method let me get every AIS_InteractiveObjects in a AIS_InteractiveContext.
And about SALOME, it seems can not be download. and i know there is TreeCtrl in SALOME by their pictures on their homepage.

Francois Lauzon's picture

to get every AIS_InteractiveObject that are in a AIS_InteractiveContext, you can use the following method:

AIS_ListOfInteractive aListOfIO;

You will have all the displayed objects in the main viewer. But you should look at the documentation to learn all the stuff you can do (cdl files, pdf files), in particular AIS_InteractiveContext.cdl and the visu40.pdf manual.

Good Luck,

François Lauzon, Ing. Stag.
Software Development Coordinator
DBM Reflex Inc.
1620 boul. Dagenais ouest
Laval, Québec

j-lin's picture

Thanks for everyone's responses.By your suggestions,i get some way to do taht,just like to use OCAF,it would be take me some time to learn,i still need to do it.
And,i have visited Stephane's homepage,it would be useful to me and any other beginners,i will try to learn and use it's ToolKit.Good luck to everybody.

Shawn Yang's picture


If you use OCAF. That will easily solve your problem.


Hao Fang's picture

If you don't use OCAF, you can store Handle(AIS_InteractiveObject) into CTreeCtrl by SetItemData each time when you create AIS_Obj, so you can get Handle(AIS_InteractiveObject) by HTREEITEM later in any time.

If you use OCAF, there is a lot of thing to learn.

Shawn Yang's picture

I am just curious. What is the name for AIS_Obj? How can you keep the same name that you set after exporting or importing the file? If you want to open or import that file, again. Thanks a lot.


fhchina's picture

AIS_Obj just a brief for AIS_InteractiveObject. As far as serialization, I haven't try, But I believe OCC/OCAF can do it well, at least there is a MFC sample together with OCC 4.0.

Stephane Routelous's picture


it is not an OpenCASCADE related question, but an MFC one, or a problem in the design of your application.

For questions about MFC, try to post into a windows programming related newsgroup or mailing list.


fhchina's picture

Faint! I couldn't access And I have downloaded 0.2 Beta Source from, but they couldn't compile. And Installer seems couldn't manipulate Win32 registy, so crashed.