Search found 43 matches

by paddle
Mon Sep 19, 2022 12:03 pm
Forum: C++ Development
Topic: wxImageList xpm icons not resizing
Replies: 3
Views: 345

Re: wxImageList xpm icons not resizing

Previous app used 3.1.4 and win7/10/linux

This app use 3.1.7 and win10.

Yes redrawing my xpm in 16x16 might be the way to do it.
by paddle
Mon Sep 19, 2022 10:02 am
Forum: C++ Development
Topic: wxImageList xpm icons not resizing
Replies: 3
Views: 345

wxImageList xpm icons not resizing

Hi there, I have a treeCtrl to which I want to attach 16x16 icons. My icons xpm files are 32 x 32. The code is as follow : void MyFrame::createImageList() { // Make an image list containing small icons wxImageList* images = new wxImageList(16, 16, true); wxBusyCursor wait; images->Add(wxIcon(iconid_...
by paddle
Mon Sep 19, 2022 9:16 am
Forum: C++ Development
Topic: XPM icon 'no conversion from "const unsigned char *[39] to "wxIcon" '
Replies: 1
Views: 312

XPM icon 'no conversion from "const unsigned char *[39] to "wxIcon" '

Hi guys, I had a very annoying bug that is solved and I just wanted to document it here in case it happens to someone. I was just trying to use some XPM icons for a treeCtrl as I did in a previous project. In short the code used : myFrame.h : #include "wx/imaglist.h" #include "icons/i...
by paddle
Wed Sep 07, 2022 1:37 pm
Forum: C++ Development
Topic: Catch mouse clicks on drawn dots on a wxPanels
Replies: 5
Views: 366

Re: Catch mouse clicks on drawn dots on a wxPanels

Connect(ID_WorldView, wxEVT_LEFT_UP, (wxObjectEventFunction)&MyFrame::onWorldClick); You need to bind the event handler directly to the panel you're painting on. And please use Bind() instead of Connect(), as it provides some type-safety to avoid crashes. your_panel->Bind(wxEVT_LEFT_UP, &My...
by paddle
Wed Sep 07, 2022 12:20 pm
Forum: C++ Development
Topic: Catch mouse clicks on drawn dots on a wxPanels
Replies: 5
Views: 366

Re: Catch mouse clicks on drawn dots on a wxPanels

Coordinates in mouse events are always relative to the window that generated the event. So if you catch the mouse click on the panel with the drawing, you should be able to use them directly. https://docs.wxwidgets.org/trunk/classwx_mouse_event.html Thanks for the feedback! Could you elaborate how ...
by paddle
Wed Sep 07, 2022 10:24 am
Forum: C++ Development
Topic: Catch mouse clicks on drawn dots on a wxPanels
Replies: 5
Views: 366

Catch mouse clicks on drawn dots on a wxPanels

Hey guys, I have a wxPanel which on which some objects are drawn (drawn as circles). When I click on one object, I want to have some information concerning that object appearing somewhere else on the app. So basically I need to catch mouse click events and have the x-y coordinates of where the click...
by paddle
Wed Sep 07, 2022 10:07 am
Forum: C++ Development
Topic: wxButton not inheriting frame colors
Replies: 3
Views: 375

wxButton not inheriting frame colors

Hi there, I set my frame background and foreground colors. Then my frame has a boxSizer and few widgets in. MyFrame::MyFrame() : wxFrame(nullptr, wxID_ANY, "Evo Simulator", wxPoint(0, 0), wxSize(800, 600)) { wxFont defaultFont(*wxSMALL_FONT); this->SetFont(defaultFont); this->SetBackground...
by paddle
Mon Jul 25, 2022 4:49 pm
Forum: C++ Development
Topic: Refresh() panel not occuring until event function is done
Replies: 3
Views: 275

Re: Refresh() panel not occuring until event function is done

Thanks for your feedback and advices!
by paddle
Mon Jul 25, 2022 12:32 pm
Forum: C++ Development
Topic: Refresh() panel not occuring until event function is done
Replies: 3
Views: 275

Re: Refresh() panel not occuring until event function is done

Adding Update()

Code: Select all

        WorldView->Update();
        WorldView->Refresh();
Force the refresh. But it flickers a little bit, which makes me think it's maybe the way to do it?
by paddle
Mon Jul 25, 2022 12:15 pm
Forum: C++ Development
Topic: Refresh() panel not occuring until event function is done
Replies: 3
Views: 275

Refresh() panel not occuring until event function is done

Hi there, I have a panel on which I'm drawing some circles. They are painted using wxEVT_PAINT and wxPaintDC : WorldView->Connect(wxEVT_PAINT, wxPaintEventHandler(MyFrame::OnPaint), NULL, this); void MyFrame::OnPaint(wxPaintEvent& event) { wxPaintDC dc(WorldView); dc.SetPen(wxColour(220, 220, 17...
by paddle
Tue Jul 12, 2022 11:27 am
Forum: C++ Development
Topic: wxPaintDC not refreshing when resizing my window
Replies: 2
Views: 203

wxPaintDC not refreshing when resizing my window

Hi there, In my frame I have several widgets in two sizers. One of them is a panel on which I want to draw things. I try to paint a circle at a position depending on the panel size. So my goal is that when I resize the window, the panel gets resized and the circle position is updated. So that the ci...
by paddle
Thu Jul 07, 2022 9:13 pm
Forum: C++ Development
Topic: Logs widget ?
Replies: 3
Views: 233

Re: Logs widget ?

Thanks very much ! :D Edit : Here's said code for reference: wxTextCtrl* logCtrl = new wxTextCtrl(mainPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2); wxLog::SetActiveTarget(new wxLogTextCtrl(logCtrl)); mainPanelSizer->Add(logCtrl, wxSiz...
by paddle
Thu Jul 07, 2022 10:09 am
Forum: C++ Development
Topic: Logs widget ?
Replies: 3
Views: 233

Logs widget ?

Hi there, My main frame has several widgets organized by a sizer. One of those is a staticText that I planned to use as a log viewer in which I wanted to print messages. Then I found that there is a class wxLogWindow which seems to be doing that. So I tried to replace my staticText by this. But this...
by paddle
Thu Jul 07, 2022 9:59 am
Forum: C++ Development
Topic: Easier way to create wxstring of text and variables
Replies: 1
Views: 158

Easier way to create wxstring of text and variables

Hi there, I've been starting a new app with wxwidget, and got stuck for some time on something as simple as creating a string. I know there's a wiki page explaining how to convert everything from and to wxString, but my code is quite ugly. (I probably havn't found the cleanest syntax to do that) Cou...