Is it possible to show wxInfoBar on top of another widget, instead of taking its own space, and also auto hides after some timeout? For example,
In this image, I have wxSearchCtrl and below it wxDataViewListCtrl, when the wxInfoBar appears, I have set its position to be below wxSearchCtrl. Just curious if it is possible to show wxInfoBar where the wxSearchCtrl is, not taking its own space?
wxInfoBar - How to show above another widget?
Re: wxInfoBar - How to show above another widget?
I would use wxRichToolTip instead.
https://docs.wxwidgets.org/trunk/classw ... l_tip.html
Check the "dialogs" sample to see it in action.
https://docs.wxwidgets.org/trunk/classw ... l_tip.html
Check the "dialogs" sample to see it in action.
Use the source, Luke!
Re: wxInfoBar - How to show above another widget?
I tried wxRichToolTip, it appears on center screen, near to where I click (I could be wrong about the position), also it does not look very native GTK control. Here is the relavent code,doublemax wrote: ↑Sun Jun 27, 2021 10:18 pm I would use wxRichToolTip instead.
https://docs.wxwidgets.org/trunk/classw ... l_tip.html
Check the "dialogs" sample to see it in action.
Code: Select all
msg = wxString::Format("Added %s to %s", name, folder_name);
wxRichToolTip tip("Info", msg);
tip.SetTipKind(wxTipKind_None);
tip.SetIcon(wxICON_INFORMATION);
tip.ShowFor(m_SampleListView);
Is it possible to show this, where the InfoBar is currently?
Re: wxInfoBar - How to show above another widget?
The ShowFor() call takes a wxRect as second parameter which can be used to set the position of the tooltip.
Yes, it's not a native control....also it does not look very native GTK control.
Use the source, Luke!
Re: wxInfoBar - How to show above another widget?
I set the the wxRect as,
Code: Select all
msg = wxString::Format("Added %s to %s", name, folder_name);
wxRect* rect = new wxRect(m_SearchBox->GetPosition(), m_SearchBox->GetSize());
wxRichToolTip tip("Info", msg);
tip.SetTipKind(wxTipKind_None);
tip.SetIcon(wxICON_INFORMATION);
tip.ShowFor(m_SampleListView, rect);
Re: wxInfoBar - How to show above another widget?
I think the rect is relative to the window you're passing. Try passing a rect of (0,0,1,1) and check where it opens.
Use the source, Luke!
Re: wxInfoBar - How to show above another widget?
Passing (0,0,1,1) for rect, shows it like this, I have hidden the InfoBar,
Not sure, but looks like at 0,0 of wxDVLC the tooltip puts its center.
Also curious, what if I, whenever I want to show InfoBar, I call Hide() for SearchCtrl, then I show the InfoBar() and when the InfoBar is closed, I call Show() for SearchCtrl?
Re: wxInfoBar - How to show above another widget?
Ok. With that information you should be able to place it where ever you want.
You could try, but i think it'll look ugly.
Use the source, Luke!