wxGrid popup dialog editing string cell causes crash Topic is solved

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
ebyrob
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed Sep 28, 2016 8:27 pm

wxGrid popup dialog editing string cell causes crash

Post by ebyrob »

I've created a default wxGrid in one of my applications using:

Code: Select all

m_pMyGrid->CreateGrid(nNumRows, nNumColumns);
and

Code: Select all

m_pMyGrid->SetCellValue("some string", nRow, nColumn);
at that point the wxGrid exists on screen with editable cells. If I click on one of the cells, I can highlight the string inside and then right click to create a pop-up menu with the following items on it:

<grey>Undo
----
Cut
Copy
Paste
Delete
----
<grey>Select All
----
RIght to left Reading order
Show Unicode control characters
Insert Unicode control character >
----
Open IME
<grey>Reconversion

I don't want this pop-up in my application and haven't been able to figure out how to disable it. Further, by clicking various options in this pop-up menu I can crash my application.

Thanks in advance for any help.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGrid popup dialog editing string cell causes crash

Post by doublemax »

The menu is the standard context menu for native text controls under Windows and can't be easily disabled. However, if you can reproduce a crash related to one of the menu entries in the "grid" sample that comes with wxWidgets, please open a bug report at: http://trac.wxwidgets.org
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGrid popup dialog editing string cell causes crash

Post by ONEEYEMAN »

Hi,
Do you have you own context menu to display?
In other words - what do you want to happen when you do a right click on that cell?

Thank you.
ebyrob
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed Sep 28, 2016 8:27 pm

Re: wxGrid popup dialog editing string cell causes crash

Post by ebyrob »

In this wxGrid I want nothing to pop up at all. I have another wxGrid in my app which is read-only cells where I popup a context menu myself which seems to work fine. I do this by handling EVT_GRID_CELL_RIGHT_CLICK.

I was able to get a debug mode diagnostic out of the "grid" sample. I'm on Windows 7, Visual Studio 2010, wxWidgets version 3.0.2.

I double clicked to select text in one of the cells of the wxGrid in the sample, then right-clicked and chose Insert Unicode Control Character->LRM.

The following diagnostic popped up:
[03] wxWindow::MSWHandleMessage c:\erp.dev\thirdparty\wxwidgets-3.0.2\src\msw\window.cpp:3504
[04] wxWindow::MSWWindowProc c:\erp.dev\thirdparty\wxwidgets-3.0.2\src\msw\window.cpp:3645
[05] wxTextCtrl::MSWWindowProc c:\erp.dev\thirdparty\wxwidgets-3.0.2\src\msw\textctrl.cpp:2083
[06] wxWndProc c:\erp.dev\thirdparty\wxwidgets-3.0.2\src\msw\window.cpp:2711
[07] gapfnScSendMessage
[08] GetThreadDesktop
[09] GetThreadDesktop
[10] GetThreadDesktop
[11] KiUserCallbackDispatcher
[12] DPA_Merge
[13] gapfnScSendMessage
[14] GetThreadDesktop
[15] GetClientRect
[16] CallWindowProcW
[17] wxWindow::MSWDefWindowProc c:\erp.dev\thirdparty\wxwidgets-3.0.2\src\msw\window.cpp:2270
[18] wxWindow::MSWWindowProc c:\erp.dev\thirdparty\wxwidgets-3.0.2\src\msw\window.cpp:3651
[19] wxTextCtrl::MSWWindowProc c:\erp.dev\thirdparty\wxwidgets-3.0.2\src\msw\textctrl.cpp:2083
[20] wxWndProc c:\erp.dev\thirdparty\wxwidgets-3.0.2\src\msw\window.cpp:2711
Do you want to stop the program?
You can also choose [Cancel] to suppress further warnings.
---------------------------
Yes No Cancel
---------------------------
Is this enough of a bug to file at trac.widgets.org or is this expected behavior?

P.S. - I can't seem to figure out how to add a forum signature, I can't find the button/box to fill in.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGrid popup dialog editing string cell causes crash

Post by doublemax »

(I should have tested this before i wrote my last post)

In wx 3.0.2 i see the same behavior as you.

In wx 3.1.0 there is no context menu. So try that version or the latest version from GIT.
P.S. - I can't seem to figure out how to add a forum signature, I can't find the button/box to fill in.
After logging in click on your user name -> User control panel -> Switch to "profile" tab -> Edit signature
Use the source, Luke!
ebyrob
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed Sep 28, 2016 8:27 pm

Re: wxGrid popup dialog editing string cell causes crash

Post by ebyrob »

Sorry for not replying sooner. It seems to work in 3.1.0 quite splendidly.
Operating System: Windows 1-, 64-bit / macOS 13.4.1, Apple M1
Compiler: Visual Studio 2019 / Xcode 14.3.1
wxWidgets version: 3.1.0 / 3.2.2
Post Reply