Search found 18 matches

by Eman
Tue Apr 21, 2020 2:21 pm
Forum: C++ Development
Topic: problem updating wxGridSizer size
Replies: 5
Views: 330

Re: problem updating wxGridSizer size

The new vboxMap that you create in OnChoice() is not assigned to any window or sizer. even if it is GUI class member? I forget to post this class: class CellPanel : public wxPanel { int x; int y; int cellStatus; } in class GUI, I have one main panel, is it ok to have many panels add to the frame? A...
by Eman
Fri Mar 06, 2020 1:49 pm
Forum: C++ Development
Topic: problem updating wxGridSizer size
Replies: 5
Views: 330

Re: problem updating wxGridSizer size

I added Layout() to the end of function OnChoice in class GUI, but nothing changed: boxMap->Layout(); gridM->Layout(); mapAndControlsHbox->Layout(); panel->Layout(); Here is my main App: Main Application #include <wx/wx.h> #include "GUI.h" // application class class pathPlanningApp : public wxApp { ...
by Eman
Fri Mar 06, 2020 12:10 am
Forum: C++ Development
Topic: problem updating wxGridSizer size
Replies: 5
Views: 330

problem updating wxGridSizer size

Hi I have problem with updating the wxGridSizer size, I cannot post the complete code since it is very long and consists of many classes. Here is a description: Inside class GUI : public wxFrame I have wxGridSizer called gridM as data member with size 8*8 when the app is initialized at the first tim...
by Eman
Thu Feb 06, 2020 3:48 am
Forum: C++ Development
Topic: change Panel color inside loop
Replies: 3
Views: 213

Re: change Panel color inside loop

void GUI::OnButtonClicked(wxCommandEvent& event) { wxWindowID buttonID = event.GetId(); //OBSTACLE=100, start=2, goal=4 ////////////// Start Button Clicked /////////////////// if(buttonID == sButtonId) { map[selectedX][selectedY]->setStatus(2);// start=2 map[selectedX][selectedY]->SetBackgroundColo...
by Eman
Wed Feb 05, 2020 10:56 pm
Forum: C++ Development
Topic: change Panel color inside loop
Replies: 3
Views: 213

change Panel color inside loop

Hello Below is a simple description for my code(which is very long to be posted here): My GUI contains grid of panels(8*8), three buttons, Choice list. When a panel is clicked and then button1 is clicked, the panel color is changed to RED When a panel is clicked and then button2 is clicked, the pane...
by Eman
Tue Sep 03, 2019 10:53 am
Forum: C++ Development
Topic: Getting data from clickable panel
Replies: 1
Views: 163

Getting data from clickable panel

Hello, I have class Cell that inherits from wxPanel, and it has its own data members( int x and int y set by i and j in the for loop below) I used Connect to make each cell clicakble and trigger the click event cellsArray[i][j]->Connect(idd, wxEVT_LEFT_DOWN, wxMouseEventHandler(GUI::OnLeftClick),NUL...
by Eman
Mon Sep 02, 2019 11:55 am
Forum: C++ Development
Topic: Adding 2d array of wxPanel to wxGridSizer
Replies: 7
Views: 365

Re: Adding 2d array of wxPanel to wxGridSizer

Thanks a lot for helping It works perfectly. I'm posting the code here to help others: /////////////////////////////////////////////////////////// int row = 8; int col = 8; wxGridSizer *gridM = new wxGridSizer(row,col,0,0); // 2d array of panels wxPanel ***cellsArray = new wxPanel**[row]; // allocat...
by Eman
Mon Sep 02, 2019 9:56 am
Forum: C++ Development
Topic: Adding 2d array of wxPanel to wxGridSizer
Replies: 7
Views: 365

Re: Adding 2d array of wxPanel to wxGridSizer

This line compile and run without any errors, but the border still not appear

Code: Select all

Array[i][j] = new wxPanel(panel, -1, wxDefaultPosition, wxDefaultSize,wxBORDER_SIMPLE);
by Eman
Mon Sep 02, 2019 9:44 am
Forum: C++ Development
Topic: Adding 2d array of wxPanel to wxGridSizer
Replies: 7
Views: 365

Re: Adding 2d array of wxPanel to wxGridSizer

This works! /////////////////////////////////////////////////////////// int row = 2; int col = 4; wxGridSizer *gridM = new wxGridSizer(row,col,0,0); // 2d array of panels wxPanel ***cellsArray = new wxPanel**[row]; // allocate rows for(int i = 0; i < row; i++) { cellsArray[i] = new wxPanel*[col]; //...
by Eman
Mon Sep 02, 2019 9:27 am
Forum: C++ Development
Topic: Adding 2d array of wxPanel to wxGridSizer
Replies: 7
Views: 365

Re: Adding 2d array of wxPanel to wxGridSizer

I searched for this error. It is because the copy constructor of wxPanel is private
Any ideas?
by Eman
Mon Sep 02, 2019 8:22 am
Forum: C++ Development
Topic: Adding 2d array of wxPanel to wxGridSizer
Replies: 7
Views: 365

Re: Adding 2d array of wxPanel to wxGridSizer

Thanks for help /////////////////////////////////////////////////////////// int row = 2; int col = 4; wxGridSizer *gridM = new wxGridSizer(row,col,0,0); // 2d array of panels wxPanel **cellsArray = new wxPanel*[row]; // allocate rows for(int i = 0; i < row; i++) { cellsArray[i] = new wxPanel[col]; /...
by Eman
Sun Sep 01, 2019 3:40 pm
Forum: C++ Development
Topic: Adding 2d array of wxPanel to wxGridSizer
Replies: 7
Views: 365

Adding 2d array of wxPanel to wxGridSizer

Hello, I want to place wxPanels representing a grid map into wxGridSizer int row = 2; int col = 4; wxPanel **cellsArray = new wxPanel*[row]; for(int i = 0; i < row; i++) { cellsArray[i] = new wxPanel[col]; } wxGridSizer *gridM = new wxGridSizer(2,4,0,0); But, adding wxPanel as an element of cellsArr...
by Eman
Sun Sep 01, 2019 1:35 pm
Forum: C++ Development
Topic: Creating Grid
Replies: 9
Views: 384

Re: Creating Grid

main.h #include <wx/wx.h> class MyApp : public wxApp { public: virtual bool OnInit(); }; main.cpp #include "main.h" #include "align.h" IMPLEMENT_APP(MyApp) bool MyApp::OnInit() { Align *align = new Align(wxT("Align")); align->Show(true); return true; } I created class Cell that inherits from wxPane...
by Eman
Sun Sep 01, 2019 1:34 pm
Forum: C++ Development
Topic: Creating Grid
Replies: 9
Views: 384

Re: Creating Grid

align.h #include <wx/wx.h> class Align : public wxFrame { public: Align(const wxString& title); }; aligh.cpp #include "align.h" #include "cell.h" Align::Align(const wxString& title) : wxFrame(NULL, -1, title, wxPoint(-1, -1), wxSize(500, 500)) { wxPanel *panel = new wxPanel(this, -1); wxBoxSizer *v...
by Eman
Sun Sep 01, 2019 1:33 pm
Forum: C++ Development
Topic: Creating Grid
Replies: 9
Views: 384

Re: Creating Grid

I created the following layout:
vboxMap ==> contains the 2d grid in the left
vboxControls ==> contains the (ok & cancel) buttons in the right

Cell.h

Code: Select all

#include <wx/wx.h>

class Cell : public wxPanel
{
public:
    Cell();

};
Cell.cpp

Code: Select all

#include "cell.h"

Cell::Cell()
	:wxPanel()
{
}