Deleting Notebook Pages...

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
Deleting Notebook Pages...

I need to delete Notebook pages during application execution.

I have created a dialog that needs to be able to delete and add Notebook pages. I thought that destroy the page widgets,using XtDestroyWidget, and then recreating them would work; however, the Notebook object apparently keeps a copy of the pages around.

Thanks in advance for the help.
C. Lamb

 ICS_support

You don`t describe the behavior you`re getting, but you may be running into one of two well-known quirks.

One stems from the fact that destruction of widgets doesn`t happen until after Xt returns from callback procedures back to its main loop. Then the destruction is complete. In the intervening time, the widgets still exist. This means that if you have a set of widgets and want to delete a particular one, adding a new one changes the count of children until "phase 2 destruction". Be aware that you may have two states for widget children normal and marked for destruction.

The second quirk comes from the memory allocator. If you destroy one widget and then immediately create another, you may well get the same pointer. XmNotebook may then not realize that the widget that is being pointed to is different. The solution is to add the new widgets before destroying the old ones, ensuring different pointer values.