Question - how to delete not a tool from this wxAuiToolBar.
for example - separator or spacer.
wxAuiToolBar - delete separator Topic is solved
wxAuiToolBar - delete separator
ubuntu 20.04, wxWidgets 3.2.1
Re: wxAuiToolBar - delete separator
There are DeleteTool() and DeleteByIndex() functions.
Read the docs: https://docs.wxwidgets.org/3.1.2/classw ... 7ddca4517d
Read the docs: https://docs.wxwidgets.org/3.1.2/classw ... 7ddca4517d
Re: wxAuiToolBar - delete separator
what is separator id?rando wrote: ↑Wed Jun 19, 2019 4:13 pm There are DeleteTool() and DeleteByIndex() functions.
Read the docs: https://docs.wxwidgets.org/3.1.2/classw ... 7ddca4517d
Code: Select all
wxAuiToolBarItem* wxAuiToolBar::AddTool(int tool_id,
const wxString & label,
const wxBitmap & bitmap,
const wxString & short_help_string = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL
)
Code: Select all
wxAuiToolBarItem* wxAuiToolBar::AddSeparator()
Last edited by alys666 on Wed Jun 19, 2019 7:43 pm, edited 1 time in total.
ubuntu 20.04, wxWidgets 3.2.1
Re: wxAuiToolBar - delete separator
Looking into the aui source code, it seems like you could use the returned pointer to set an id and then later use that id to delete it. Might be worth a try.
Use the source, Luke!
Re: wxAuiToolBar - delete separator
I usually clear the complete toolbar then rebuild it with the needed tools and layout as required. You can have a function to do that with an enum argument that lists your various layouts. Doing it that way produces easier to read and modify code down the road.
Re: wxAuiToolBar - delete separator
in my case, I have a "stack like looking" tool bar.rando wrote: ↑Wed Jun 19, 2019 5:34 pm I usually clear the complete toolbar then rebuild it with the needed tools and layout as required. You can have a function to do that with an enum argument that lists your various layouts. Doing it that way produces easier to read and modify code down the road.
from the beginning there are basic tools, but when some subsystem gets activated, it added its tools at start, and removes at finish. subsystem knows nothing about parent tool set, and won't do it.
to solve I would add a pseudoseparator, kinda void tool with vertical bar, as a label.
but, i think, wxWIdgets needs a ticket about it.
wxAuiToolbar definitely suffers from lack of method DeleteItem(wxAuiToolBarItem*)
ubuntu 20.04, wxWidgets 3.2.1
Re: wxAuiToolBar - delete separator
I wonder if GetToolCount() would work for you, store the highest index before you add anything then DeleteByIndex() all of the items after that one when you are ready to remove the added tools. That is assuming you always add/remove from the end.
DeleteByIndex(int tool_id) I think is actually DeleteByIndex(int idx) but you would need to check the source to know for sure. I am on my way home so no time for that right now, sorry.
DeleteByIndex(int tool_id) I think is actually DeleteByIndex(int idx) but you would need to check the source to know for sure. I am on my way home so no time for that right now, sorry.
Re: wxAuiToolBar - delete separator
yes, rando. your idea works well.
ps. i discovered just now that actually it's an instance of wxToolBar, not wxAuiToolBar... but there is a the same problem.
My old code uses wxToolbar, but since some time i switched to wxAuiToolbar... but can't understand serious difference for now, except of mentioning that wxToolbar is dockable only under GTK.
ps. i discovered just now that actually it's an instance of wxToolBar, not wxAuiToolBar... but there is a the same problem.
My old code uses wxToolbar, but since some time i switched to wxAuiToolbar... but can't understand serious difference for now, except of mentioning that wxToolbar is dockable only under GTK.
ubuntu 20.04, wxWidgets 3.2.1