I have a toolbar where I'm adding a separator followed by some
controls. I want to be able to remove those controls and the separator
at runtime but I don't see any way to identify this particular
separator, and delete it (the position may change between the time I
insert it and I delete it). What is the correct way for adding and
then later deleting a separator?
You can clear all tools and then add the ones you want to keep to the toolbar again.
···
On 3/22/10 8:02 AM, Bryan Oakley wrote:
I have a toolbar where I'm adding a separator followed by some
controls. I want to be able to remove those controls and the separator
at runtime but I don't see any way to identify this particular
separator, and delete it (the position may change between the time I
insert it and I delete it). What is the correct way for adding and
then later deleting a separator?
--
Robin Dunn
Software Craftsman
That's definitely not an option for me. I'm working in a plugin model
where a plugin can add or remove things from a toolbar. It can't
simply delete all the things in the toolbar and start fresh.
Eventually I figured out that I can do something like this:
self.sep = self.toolbar.AddSeparator()
...
self.toolbar.DeleteTool(self.sep.GetId())
···
On Mon, Mar 22, 2010 at 1:10 PM, Robin Dunn <robin@alldunn.com> wrote:
On 3/22/10 8:02 AM, Bryan Oakley wrote:
I have a toolbar where I'm adding a separator followed by some
controls. I want to be able to remove those controls and the separator
at runtime but I don't see any way to identify this particular
separator, and delete it (the position may change between the time I
insert it and I delete it). What is the correct way for adding and
then later deleting a separator?You can clear all tools and then add the ones you want to keep to the
toolbar again.
Unfortunately I think that all separators have the same ID, which is why I didn't suggest that.
···
On 3/22/10 11:18 AM, Bryan Oakley wrote:
On Mon, Mar 22, 2010 at 1:10 PM, Robin Dunn<robin@alldunn.com> wrote:
On 3/22/10 8:02 AM, Bryan Oakley wrote:
I have a toolbar where I'm adding a separator followed by some
controls. I want to be able to remove those controls and the separator
at runtime but I don't see any way to identify this particular
separator, and delete it (the position may change between the time I
insert it and I delete it). What is the correct way for adding and
then later deleting a separator?You can clear all tools and then add the ones you want to keep to the
toolbar again.That's definitely not an option for me. I'm working in a plugin model
where a plugin can add or remove things from a toolbar. It can't
simply delete all the things in the toolbar and start fresh.Eventually I figured out that I can do something like this:
self.sep = self.toolbar.AddSeparator()
...
self.toolbar.DeleteTool(self.sep.GetId())
--
Robin Dunn
Software Craftsman
Hmmm. You're right. Oddly, when I delete using the ID only the first
separator gets deleted.
It's hard to believe you can add separators but can't remove them.
···
On Mon, Mar 22, 2010 at 1:50 PM, Robin Dunn <robin@alldunn.com> wrote:
Unfortunately I think that all separators have the same ID, which is why I
didn't suggest that.