Search found 15164 matches

by doublemax
Fri Oct 09, 2020 7:27 am
Forum: C++ Development
Topic: Problem with bitmap
Replies: 5
Views: 236

Re: Problem with bitmap

is there any way to deal with coordinates in bitmap the same way as if it is array or table
I don't see where the problem is. Just consider the gridpanel class a black box where the method happens to take the parameters in x,y order. But you can of course change that yourself easily if you like.
by doublemax
Thu Oct 08, 2020 10:38 pm
Forum: C++ Development
Topic: Problem with bitmap
Replies: 5
Views: 236

Re: Problem with bitmap

Code: Select all

for(int i=0; i<row ; i++)
  for(int j=0; j<col ;j++)
    if(grid[i][j] == 1) // blocked = black
      gp->SetCellColor(i,j,black);
In this code "j" is "x" and "i" is "y". But SetCellColor() takes x first, then y. So just swap the parameters
by doublemax
Thu Oct 08, 2020 12:18 am
Forum: C++ Development
Topic: problem with array of wxPanel
Replies: 22
Views: 545

Re: problem with array of wxPanel

Here's a GridPanel class based on a wxBitmap: gridpanel.h Sample code for initializing it: GridPanel *gp = new GridPanel(panel, 256, 256, 5); gp->SetSize(10,10, 1280,1280); wxColor black = wxColor(0,0,0); gp->SetCellColor(0,0, black); gp->SetCellColor(1,1, black); gp->SetCellColor(2,2, black); gp->S...
by doublemax
Wed Oct 07, 2020 11:33 pm
Forum: C++ Development
Topic: problem with array of wxPanel
Replies: 22
Views: 545

Re: problem with array of wxPanel

There are many even faster ways, but it all depends on what the end result should look like. E.g. if you only wanted colored squares without separating lines, you could use a bitmap where one pixel represents one square (of arbritrary size) and you could just scale it with a fixed factor when drawing.
by doublemax
Wed Oct 07, 2020 10:31 pm
Forum: C++ Development
Topic: problem with array of wxPanel
Replies: 22
Views: 545

Re: problem with array of wxPanel

Setting the background color for each cell is slowing everything down here.

Here's a solution with a custom renderer:
gui.cpp
(2.59 KiB) Downloaded 23 times
My version with a custom drawing would still be much, much faster.
by doublemax
Wed Oct 07, 2020 7:10 pm
Forum: C++ Development
Topic: Help needed with using validator please
Replies: 2
Views: 117

Re: Help needed with using validator please

First of all: In 99% of cases a wxDialog should be used as a modal dialog, called with ShowModal() instead of Show(). Are you sure you want a non-modal one? You need to call Validate() yourself: https://docs.wxwidgets.org/trunk/overview_validator.html#overview_validator_dialogs Also, if you just wan...
by doublemax
Wed Oct 07, 2020 7:01 pm
Forum: C++ Development
Topic: problem with array of wxPanel
Replies: 22
Views: 545

Re: problem with array of wxPanel

Can I add empty label or any object that does not consume memory in wxGridSizer of size 256*256 If you want to set individual colors to it, no. So now you're discarding everything i said so far and try to use wxPanels again? Please explain to me why my first suggestion with demo code does not work ...
by doublemax
Wed Oct 07, 2020 5:59 pm
Forum: C++ Development
Topic: Return value of the Create() method for two-step creation.
Replies: 3
Views: 136

Re: Return value of the Create() method for two-step creation.

AFAIK if one makes wxWindow A child of the wxWindow B by passing B to A via the Create() method, then if B is destroyed A is too. Is this correct? Yes. if so, does this still hold true if A's Create() method fails? That can't be answered universally, it depends on how far the Create() method comes ...
by doublemax
Wed Oct 07, 2020 4:43 pm
Forum: C++ Development
Topic: Return value of the Create() method for two-step creation.
Replies: 3
Views: 136

Re: Return value of the Create() method for two-step creation.

Given that each Create method invokes the parent's Create method, I assume that eventually the base class will record the object's pointer for later destruction right away, and therefore if one of the Create methods in the chain fails, the object will not leak: is this correct? Not necessarily. The...
by doublemax
Tue Oct 06, 2020 9:54 pm
Forum: C++ Development
Topic: mouseOver lines on wxBitmap
Replies: 5
Views: 269

Re: mouseOver lines on wxBitmap

After a look into the sources, it seems that at least under Windows there's dedicated platform specific code that creates a region from a polygon without rendering it into a bitmap. So it's possible that at least under Windows a wxRegion can be both small and fast. I didn't make any performance test...
by doublemax
Tue Oct 06, 2020 5:11 am
Forum: C++ Development
Topic: problem with array of wxPanel
Replies: 22
Views: 545

Re: problem with array of wxPanel

You'll need a custom wxGridCellRenderer for that. Check the "grid" sample that comes with wxWidgets and search for "MyGridCellRenderer".
by doublemax
Mon Oct 05, 2020 10:08 pm
Forum: C++ Development
Topic: problem with array of wxPanel
Replies: 22
Views: 545

Re: problem with array of wxPanel

Eman wrote:
Mon Oct 05, 2020 9:51 pm
Thanx for help. Could I use wxGrid (tables), and hide the row and column labels?
Theoretically, yes. But i doubt this would make your life easier. Of course it all depends on what the final goal is.
by doublemax
Mon Oct 05, 2020 4:01 pm
Forum: Platform Related Issues
Topic: SetMinSize() and SetSizeHints() platform differences with X11 and Wayland
Replies: 7
Views: 240

Re: SetMinSize() and SetSizeHints() platform differences with X11 and Wayland

hamishmb wrote:
Mon Oct 05, 2020 3:55 pm
Is there a simple demo program I can compile and use like with the wxPython demo?
yes, the "minimal" sample that comes with wxWidgets. You'll just have to add a few lines to demonstrate the bug/problem.
by doublemax
Mon Oct 05, 2020 3:42 pm
Forum: Platform Related Issues
Topic: SetMinSize() and SetSizeHints() platform differences with X11 and Wayland
Replies: 7
Views: 240

Re: SetMinSize() and SetSizeHints() platform differences with X11 and Wayland

Please try to reproduce the issue with a C++ version and wx 3.0.4 first, and then try the same with 3.1.4 or the latest version from Github.

Please also mention whether you built wxWidgets with GTK2 or GTK3.
by doublemax
Sun Oct 04, 2020 12:01 pm
Forum: C++ Development
Topic: wxStaticText newbie question
Replies: 4
Views: 174

Re: wxStaticText newbie question

Sorry, i wrote that without testing it, it doesn't work that way.

Code: Select all

wxFont font = text->GetFont();
font.SetPointSize(16);
text->SetFont(font);