Search found 16186 matches

by doublemax
Thu Aug 05, 2021 10:18 pm
Forum: C++ Development
Topic: How to draw a transparent rectangle over an existing drawing?
Replies: 8
Views: 97

Re: How to draw a transparent rectangle over an existing drawing?

Do you still have the timer running that constantly refreshes the panel? If not you'll have to call Refresh() when the drag operation ends, so that the rubberband can get overdrawn.
by doublemax
Thu Aug 05, 2021 6:54 pm
Forum: C++ Development
Topic: How to draw a transparent rectangle over an existing drawing?
Replies: 8
Views: 97

Re: How to draw a transparent rectangle over an existing drawing?

Why are you still using wxClientDC? All drawing should happen in the paint event handler. Also, i think there's too much "low-level" information used in the paint event handler. It shouldn't have to deal with things like mouse-button pressed or not. It only needs the information relevant for drawing...
by doublemax
Thu Aug 05, 2021 12:16 pm
Forum: C++ Development
Topic: How to draw a transparent rectangle over an existing drawing?
Replies: 8
Views: 97

Re: How to draw a transparent rectangle over an existing drawing?

... the rectangle I draw for selection keep appearing and disappearing, probably because the panel is being updated. Also after I lift the left button up, it doesn't draw the other rectangle I had the DrawSelectionArea() for, This kind of stuff happens when you're using wxClientDC, because the stat...
by doublemax
Thu Aug 05, 2021 8:28 am
Forum: C++ Development
Topic: How to draw a transparent rectangle over an existing drawing?
Replies: 8
Views: 97

Re: How to draw a transparent rectangle over an existing drawing?

however it uses a method CalcUnscrolledPosition() which a method of wxScrolledWindow, but I am drawing on wxPanel, what should be the equivalent of this method for wxPanel? You can just remove it, you don't need it in a wxPanel. Also it starts drawing the rectangle as soon as I press CTRL but I onl...
by doublemax
Wed Aug 04, 2021 10:39 pm
Forum: C++ Development
Topic: wxDataViewModel::GetValue doesn't ask for children in the order placed in wxDataViewItemArray
Replies: 11
Views: 141

Re: wxDataViewModel::GetValue doesn't ask for children in the order placed in wxDataViewItemArray

I have no first-hand experience with wxDVC, so unfortunately i can't help with this. But as it's a relatively old control, i doubt there is a fundamental bug in the sort handling. It's probably a case of bad documentation. Can you adapt your code to use one of the built-in wxDataViewModels? Or maybe...
by doublemax
Wed Aug 04, 2021 5:50 pm
Forum: C++ Development
Topic: wxDataViewModel::GetValue doesn't ask for children in the order placed in wxDataViewItemArray
Replies: 11
Views: 141

Re: wxDataViewModel::GetValue doesn't ask for children in the order placed in wxDataViewItemArray

I don't know too much about wxDVC, but after looking at the methods of related classes: - when creating a wxDataViewColumn, add the wxDATAVIEW_COL_SORTABLE - call wxSettableHeaderColumn::SetSortable( true ) - implement sorting related methods in your wxDataViewModel In general, check the "dataview" ...
by doublemax
Wed Aug 04, 2021 4:58 pm
Forum: C++ Development
Topic: wxDataViewModel::GetValue doesn't ask for children in the order placed in wxDataViewItemArray
Replies: 11
Views: 141

Re: wxDataViewModel::GetValue doesn't ask for children in the order placed in wxDataViewItemArray

What platform are you using and do you have a custom wxDataViewModel ? Unless you explicitly set a sort order, there is no guarantee that the items are displayed in the same order they were inserted. It depends on the model's implementation. Storing items in a linked list would be too slow for large...
by doublemax
Tue Aug 03, 2021 9:04 pm
Forum: C++ Development
Topic: How to check if a key is pressed?
Replies: 1
Views: 38

Re: How to check if a key is pressed?

wxMouseEvent derives from wxKeyboardState, so you can just use event.ControlDown() in a mouse event handler.
by doublemax
Tue Aug 03, 2021 5:34 am
Forum: C++ Development
Topic: Best way to render Large Size images
Replies: 11
Views: 235

Re: Best way to render Large Size images

Note that each time you update your image array you will have to reset the data in the wxMemoryDC That's a good alternative if the required drawing operations are very simple (like points and lines). But the conversion from wxImage to wxBitmap is slow (done pixel by pixel), so it would be better to...
by doublemax
Mon Aug 02, 2021 5:51 pm
Forum: C++ Development
Topic: Best way to render Large Size images
Replies: 11
Views: 235

Re: Best way to render Large Size images

I'd recommend to filter out those of points that overlapped with others with some reasonable precise. In that case you will have much less drawing. Yes, that's what i did. I only rendered as many (vertical) lines as visible pixels in x-direction. To my surprise the calculation of max or average val...
by doublemax
Mon Aug 02, 2021 5:04 pm
Forum: C++ Development
Topic: Best way to render Large Size images
Replies: 11
Views: 235

Re: Best way to render Large Size images

I made some tests and on a 1920 pixel wide screen i get at least 20fps with a graphics height of 480pixel. Even if i calculate max or average values for each pixel.

So this should be no problem performance wise.
(and there is even room for more performance optimization :) )
by doublemax
Mon Aug 02, 2021 5:07 am
Forum: C++ Development
Topic: Crash on the wxLog->Flush
Replies: 1
Views: 86

Re: Crash on the wxLog->Flush

You need to delete the new logtarget first and restore the old one.

Code: Select all

  wxLog* oldLog = wxLog::SetActiveTarget(new wxLogStderr);

  [...] using log here

  delete wxLog::SetActiveTarget(oldLog);
by doublemax
Mon Aug 02, 2021 5:01 am
Forum: C++ Development
Topic: My first project
Replies: 1
Views: 65

Re: My first project

Hello and welcome to the forum. In general, support for monochrome bitmaps in wxWidgets is low. But this constructor can at least create a bitmap from monochrome data: https://docs.wxwidgets.org/trunk/classwx_bitmap.html#a6ee4099d6c4c9532aff6e5c1de516f21 There are several ways to display a wxBitmap ...
by doublemax
Sun Aug 01, 2021 7:53 am
Forum: C++ Development
Topic: Event when click on menu
Replies: 14
Views: 603

Re: Event when click on menu

Also I noticed a behavior that I didn't necessarily want: If I click on "File" and open this menu and then move the mouse over the next menu "Search", the search dialog is shown as well. Is there a way to make the dialog only show up if the user also clicks on the menu? I can't think of any way to ...