Personal tools
You are here: Home Forum How to use Salome? Failed to get Selected Item from LightApp_SelectionMgr

Failed to get Selected Item from LightApp_SelectionMgr

Up to How to use Salome?

Failed to get Selected Item from LightApp_SelectionMgr

Posted by Yuefeng Qiu at February 07. 2013

Hello!

I am learning to integrate module into SALOME. My test code create some regular meshes and organizes these meshes in mesh groups. 

My problem is: after creating a Mesh Group, I try to select this group and obtain its Group ID by LightApp_SelectionMgr, but there is nothing in the selected list. I need the Group ID for appending new meshes.

I attach my code for debugging. The problem occurs in XYZMESHGUI_CreateMeshOp.cxx:67. 

Thanks !

BTW, is it a good choice to use LightApp_Operation and LightApp_Dialog? I found them laborious and unclear for usage. 

Attachments

Re: Failed to get Selected Item from LightApp_SelectionMgr

Posted by Yuefeng Qiu at February 08. 2013

I think I found the reason by myself. The selected items are removed each time the UpdateBrowser() is called. One bug in my code cause calling of this method before obtaining the select list. that is why I get nothing.

Re: Failed to get Selected Item from LightApp_SelectionMgr

Posted by Vadim SANDLER at February 08. 2013

Hello Yuefeng,

Actually selection manager seems to work OK. When I select created group in the Object browser, invoke "GenerateMesh" operation from menu and press OK button, I can see in debugger that QString aEntry is "XYZMESHGUI_1" (line 74 of XYZMESHGUI_CreateMeshOp.cxx file) - exactly as shown in the "Entry" column of the Object browser. Moreover, after next code line aGroupId is 1 (ok).

However, then the application crashes. I did not analyze the reason, it seems to be a problem with the data model.

Regarding LightApp_Operation and LightApp_Dialog classes - indeed, you are not obliged to use these helper classes in your module, you can use any alternative approach to implement GUI actions.

Regards,
Vadim.

Re: Failed to get Selected Item from LightApp_SelectionMgr

Posted by Yuefeng Qiu at February 08. 2013

Thanks, Vadim!

I have a bug in the  XYZMESHGUI_CreateMeshOp::OnApply(), which invokes the abort() method. the object browser is updated therefore all selected item is deselected. 

I think LightApp_Operation and LightApp_Dialog classes offer useful methods for controlling the GUI interaction. Unfortunately there is no very detail documents and tutorials and therefore hard for me to know its mechanism. A good helper class is wasted. 


Powered by Ploneboard
Document Actions