wxDataViewListCtrl on click item action not executing.

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.
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDataViewListCtrl on click item action not executing.

Post by doublemax »

Can you make this publicly available? Maybe put into the repo?
Use the source, Luke!
apoorv569
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Tue Oct 20, 2020 3:35 pm

Re: wxDataViewListCtrl on click item action not executing.

Post by apoorv569 »

doublemax wrote: Tue Jan 19, 2021 9:39 pm Can you make this publicly available? Maybe put into the repo?
Okay I just made a repository for this demo/test project - https://gitlab.com/apoorv569/cpp-projec ... /wxDvcTest
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDataViewListCtrl on click item action not executing.

Post by doublemax »

Thanks. I haven't built it myself yet, but please try these things:

1) remove App constructor and destructor completely
2) app.h - instead of #include <wx/app.h>, #include <wx/wx.h>
3) mainframe.hpp - remove include #include <wx/defs.h>, frame.h, gdicmn.h, include <wx/wx.h> first

How do you link sqlite?
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDataViewListCtrl on click item action not executing.

Post by ONEEYEMAN »

Hi,
Basically what doublemax says - you need to follow the wxWidgets samples.

Thank you.
apoorv569
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Tue Oct 20, 2020 3:35 pm

Re: wxDataViewListCtrl on click item action not executing.

Post by apoorv569 »

doublemax wrote: Tue Jan 19, 2021 10:35 pm Thanks. I haven't built it myself yet, but please try these things:

1) remove App constructor and destructor completely
2) app.h - instead of #include <wx/app.h>, #include <wx/wx.h>
3) mainframe.hpp - remove include #include <wx/defs.h>, frame.h, gdicmn.h, include <wx/wx.h> first
I tried all steps no luck.
doublemax wrote: Tue Jan 19, 2021 10:35 pm How do you link sqlite?
I have set sqlite as a dependency in `meson.build` it auto find the library and links to it.

Code: Select all

sqlite3 = dependency('sqlite3')
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDataViewListCtrl on click item action not executing.

Post by doublemax »

In the meanwhile i tested under Windows using the sqlite amalgamation and it worked fine.

As i usually don't work under Linux, testing under Linux might take a while, but i'm starting to suspect that it would work too and that there is something wrong with your build setup.

I have no idea what Meson does behind the curtains, but i would try to build the sample without it and check if it makes any difference.
Use the source, Luke!
apoorv569
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Tue Oct 20, 2020 3:35 pm

Re: wxDataViewListCtrl on click item action not executing.

Post by apoorv569 »

doublemax wrote: Tue Jan 19, 2021 11:09 pm In the meanwhile i tested under Windows using the sqlite amalgamation and it worked fine.

As i usually don't work under Linux, testing under Linux might take a while, but i'm starting to suspect that it would work too and that there is something wrong with your build setup.

I have no idea what Meson does behind the curtains, but i would try to build the sample without it and check if it makes any difference.
Okay I tried compiling it manually, looking around the internet this is what I found how to link and compile wx and sqlite using g++

Code: Select all

g++ app.cpp `wx-config-gtk3 --libs --cxxflags` MainFrame.cpp `wx-config-gtk3 --libs --cxxflags` -l sqlite3
I hope this is the right command, it does compile successfully and creates a `a.out` file, which when I run is causing the same problem as before.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDataViewListCtrl on click item action not executing.

Post by ONEEYEMAN »

Hi,
And I presume you are using the pre-built library from the OS repository?

I didn't see anything wrong with the way you compile.
Although I would prefer:

Code: Select all

g++ *.cpp -o test `wx-config --cxxflags --libs` -lsqlite3
Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDataViewListCtrl on click item action not executing.

Post by doublemax »

So i managed to build this under LInux (wx3.1.4), and to me it seems that the event handler is called, but just the std::cout stops working. Because when i replaced that with a wxLogMessage(), it showed up.

Please check that on your side.
Use the source, Luke!
apoorv569
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Tue Oct 20, 2020 3:35 pm

Re: wxDataViewListCtrl on click item action not executing.

Post by apoorv569 »

ONEEYEMAN wrote: Wed Jan 20, 2021 2:17 am Hi,
And I presume you are using the pre-built library from the OS repository?

I didn't see anything wrong with the way you compile.
Although I would prefer:

Code: Select all

g++ *.cpp -o test `wx-config --cxxflags --libs` -lsqlite3
Thank you.
Yes, I installed the library from OS repository, I did not compile it myself. Though on my system there is no `wx-config` but there is `wx-config-gtk3` I assume `wx-config` is for GTK 2, and I installed the `wxgtk3` package.
apoorv569
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Tue Oct 20, 2020 3:35 pm

Re: wxDataViewListCtrl on click item action not executing.

Post by apoorv569 »

doublemax wrote: Wed Jan 20, 2021 7:46 am So i managed to build this under LInux (wx3.1.4), and to me it seems that the event handler is called, but just the std::cout stops working. Because when i replaced that with a wxLogMessage(), it showed up.

Please check that on your side.
Yes I replaced the std::cout with wxLogMessage(), and the popup shows up with the message fine. Why does std::cout stops working after adding a entry to wxDVC though.
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDataViewListCtrl on click item action not executing.

Post by doublemax »

apoorv569 wrote: Wed Jan 20, 2021 10:49 am Why does std::cout stops working after adding a entry to wxDVC though.
No idea. Maybe sqlite does something internally that breaks it. Although that should be very unlikely, because a) sqlite is widely used and b) it's pure C, not C++
Use the source, Luke!
apoorv569
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Tue Oct 20, 2020 3:35 pm

Re: wxDataViewListCtrl on click item action not executing.

Post by apoorv569 »

doublemax wrote: Wed Jan 20, 2021 10:53 am
apoorv569 wrote: Wed Jan 20, 2021 10:49 am Why does std::cout stops working after adding a entry to wxDVC though.
No idea. Maybe sqlite does something internally that breaks it. Although that should be very unlikely, because a) sqlite is widely used and b) it's pure C, not C++
I found some posts where people are saying that std::cout is a buffered output and might get stuck after a while, and should use std::cout.flush() to flush the buffer, I tried this but no luck. Is there a wx inbuilt function to print to the console instead, wxLogMessage shows a popup, is there a alternate that does not open a popup and prints to console.
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDataViewListCtrl on click item action not executing.

Post by doublemax »

Try wxLogDebug
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxDataViewListCtrl on click item action not executing.

Post by PB »

Or, if wxLogDebug() output is consumed by the debugger and may not be shown (e.g., gdb on MSW), one can try good old wxPrintf(). However, this probably won't be shown on MSW.
Post Reply