Search found 2960 matches

by PB
Fri Apr 23, 2021 11:34 am
Forum: C++ Development
Topic: Bind Dialog Event with a MainWindow handler
Replies: 2
Views: 44

Re: Bind Dialog Event with a MainWindow handler

I personally would not do some crazy passing around variables and exposing the internals of a class. I would introduce a new event, which would be generated by the dialog and handled in the frame. It could look like this, where the code passes around an editable string between a wxFrame (MyFrame) an...
by PB
Fri Apr 23, 2021 7:25 am
Forum: C++ Development
Topic: wxScrolledWindow do not scroll to focused wxTextCtrl
Replies: 11
Views: 188

Re: wxScrolledWindow do not scroll to focused wxTextCtrl

FWIW, the code below works for me as expected, i.e., after pressing <Enter> in the last text control, a new text control is added, focused, and scrolled into view. After adding a new control, m_scrolled->FitInside() must be called before textCtrl->Focus(). #include <wx/wx.h> #include <wx/scrolwin.h>...
by PB
Thu Apr 22, 2021 12:07 pm
Forum: C++ Development
Topic: Best way to draw non-antialiased image with alpha support?
Replies: 2
Views: 39

Re: Best way to draw non-antialiased image with alpha support?

Or, do not scale the image during each repaint. Scale it only when the image size or the scale changes and store the scaled image.

Additionally, converting a wxImage to a wxGraphicBitmap can be expensive, so do not do that during every redraw either.
by PB
Mon Apr 19, 2021 5:27 pm
Forum: C++ Development
Topic: How to efficiently create wxBitmap from std::vector<std::vector<wxColour>>
Replies: 2
Views: 65

Re: How to efficiently create wxBitmap from std::vector<std::vector<wxColour>>

wxBitmap, just as any other GUI object (and unlike wxImage), cannot be used in a secondary thread. While it may work on some platforms, the docs clearly say do not this. But while this applies to e.g. wxPens or wxBrushes, I am not sure if it really does to wxBitmap. BTW, I am just curious, how much ...
by PB
Mon Apr 19, 2021 12:39 pm
Forum: Platform Related Issues
Topic: Getting windows mousepointer icon = black square
Replies: 25
Views: 441

Re: Getting windows mousepointer icon = black square

But.... should'nt the new code be inside the "if ( hbmp )" branch, instead of outside of it? Actually, looking at the code, I think it should be inside the block guarded by statement if ( ::GetObject(hbmp, sizeof(BITMAP), (LPSTR) &bm) ) However, in practice it does not matter, as when that block do...
by PB
Sun Apr 18, 2021 6:30 pm
Forum: C++ Development
Topic: wxAuiNotebook::OnLeftUp not working
Replies: 21
Views: 205

Re: wxAuiNotebook::OnLeftUp not working

I just checked and it works with one page even with wxWidgets 3.0.5. The only change needed with this old version was to uninitialize wxAuiManager manually. I do not understand how can you have issues with linking with my example code, as it cannot use anything else than your code does? Even if you ...
by PB
Sun Apr 18, 2021 6:20 pm
Forum: C++ Development
Topic: wxAuiNotebook::OnLeftUp not working
Replies: 21
Views: 205

Re: wxAuiNotebook::OnLeftUp not working

I checked out the wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING event. It is not working, when you have just one page. This is not true, at least with wxWidgets 3.1.5 on MS Windows. When I comment out this line //m_notebook->AddPage(new wxPanel(m_notebook), "Page 1", true); i.e., m_notebook has just one ...
by PB
Sun Apr 18, 2021 5:37 pm
Forum: C++ Development
Topic: wxAuiNotebook::OnLeftUp not working
Replies: 21
Views: 205

Re: wxAuiNotebook::OnLeftUp not working

I dont think this works because the page changing is not working, since you just have one page, the "+" page. I do not understand, in my code there are always at least two pages. It also does work if there is just the "Add Page" alone. As ONEEYEMAN already wrote, did you even try running the code? ...
by PB
Sun Apr 18, 2021 3:17 pm
Forum: C++ Development
Topic: wxAuiNotebook::OnLeftUp not working
Replies: 21
Views: 205

Re: wxAuiNotebook::OnLeftUp not working

I think the SSCCE below does what you asked, i.e., adding a page after clicking the tab of the first wxAuiNotebook page. The code expects there is at least one more page after the "Add Page"; however, that would be easy to change (i.e., bind the mouse up from the page itself, e.g., a wxPanel), so I ...
by PB
Sun Apr 18, 2021 2:43 pm
Forum: C++ Development
Topic: wxAuiNotebook::OnLeftUp not working
Replies: 21
Views: 205

Re: wxAuiNotebook::OnLeftUp not working

With wxAuiNotebook one has to bind EVT_AUINOTEBOOK_TAB_* events. However, there is no events for the left mouse button, only for the middle and right one. I guess the left mouse click on the tab is transformed to the appropriate EVT_AUINOTEBOOK_PAGE_* event. Using wxNootebook gives me mouse left bu...
by PB
Sun Apr 18, 2021 2:33 pm
Forum: C++ Development
Topic: wxAuiNotebook::OnLeftUp not working
Replies: 21
Views: 205

Re: wxAuiNotebook::OnLeftUp not working

As I always, I would start with reducing the code to make sure the window hierarchy actually has any effect on the issue.

Often, one figures out what is wrong by themselves when doing so.
by PB
Sun Apr 18, 2021 2:23 pm
Forum: C++ Development
Topic: wxAuiNotebook::OnLeftUp not working
Replies: 21
Views: 205

Re: wxAuiNotebook::OnLeftUp not working

I have just tried replacing wxNotebook with wxAuiNotebook and then I do not get the mouse events. With wxAuiNotebook one has to bind EVT_AUINOTEBOOK_TAB_* events. However, there is no events for the left mouse button, only for the middle and right one. I guess the left mouse click on the tab is tran...
by PB
Sun Apr 18, 2021 2:06 pm
Forum: C++ Development
Topic: wxAuiNotebook::OnLeftUp not working
Replies: 21
Views: 205

Re: wxAuiNotebook::OnLeftUp not working

I cannot reproduce the issue (wxWidgets 3.1.5, Windows 10) with this SSCCE, which should pretty much mimic your code: #include <wx/wx.h> #include <wx/aui/aui.h> #include <wx/notebook.h> class MyFrame: public wxFrame { public: MyFrame() : wxFrame (nullptr, wxID_ANY, "Test") { wxPanel* panel = new wxP...
by PB
Sat Apr 17, 2021 8:13 am
Forum: Platform Related Issues
Topic: Getting windows mousepointer icon = black square
Replies: 25
Views: 441

Re: Getting windows mousepointer icon = black square

The issue just has been fixed in wxWidgets master: https://github.com/wxWidgets/wxWidgets/commit/b889f6897ba8429c02e598ee9d5a366347fef477 current-cursor.gif #include <wx/wx.h> #include <wx/msw/wrapwin.h> bool GetFromCurrentCursor(wxIcon& icon, wxBitmap& bitmap) { CURSORINFO ci{0}; wxIcon tmpIcon; wx...
by PB
Fri Apr 16, 2021 5:39 pm
Forum: Platform Related Issues
Topic: Getting windows mousepointer icon = black square
Replies: 25
Views: 441

Re: Getting windows mousepointer icon = black square

Attempting to fix wxWidgets code, I have realized that perhaps monochrome icons cannot be properly stored in a wxBitmap/wxImage. wxBitmap stores pixels to be drawn and optionally a transparent mask to indicate which pixels to not draw. Similarly with alpha for wxBitmap/wxImage. However, a monochrome...