wxGrid disable/enable

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 423
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

wxGrid disable/enable

Post by raananb » Sun Apr 26, 2020 4:23 pm

wxWidgets 3.1.3 Windows 10.

wxGrid is created and Enabled() at a wxDialog window startup and it functions correctly.

At a point the grid is Disabled().

When later the grid is Enabled() - in the same wxDialog window - nothing happens. The grid ramains disabled.

Any ideas?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4170
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGrid disable/enable

Post by ONEEYEMAN » Sun Apr 26, 2020 7:18 pm

Hi,
How do you enable/disable the grid? an you post some code?

Thank you.

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 423
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: wxGrid disable/enable

Post by raananb » Mon Apr 27, 2020 11:18 am

The grid element is created by DialogBlocks and added to sizer itemBoxSizer2.

Code: Select all

wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);

grid = new wxGrid( itemDialog1, ID_GRIDGestionEntites, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
grid->SetDefaultColSize(50);
grid->SetDefaultRowSize(25);
grid->SetColLabelSize(25);
grid->SetRowLabelSize(50);
grid->CreateGrid(1, 4, wxGrid::wxGridSelectCells);
itemBoxSizer2->Add(grid, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
At a point in the application, the grid is disabled (which works).

Code: Select all

grid->Disable();
.....
// Some processing, including 
.....
grid->AppendRows();
.....
// new item recorded in database - everything executes as expected up to here
.....
grid->Enable();


Wolfram
In need of some credit
In need of some credit
Posts: 8
Joined: Wed Jul 24, 2019 2:14 pm

Re: wxGrid disable/enable

Post by Wolfram » Mon Apr 27, 2020 11:24 am

Maybe EnableEditing(true) would help?

User avatar
doublemax
Moderator
Moderator
Posts: 14891
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGrid disable/enable

Post by doublemax » Mon Apr 27, 2020 11:42 am

Try calling grid->Refresh(). Maybe it's just a redraw issue.
Use the source, Luke!

Post Reply