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: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDataViewListCtrl on click item action not executing.

Post by doublemax »

I'm pretty much out of ideas, but i still think it's something simple ;)

Does the "dataview" sample work for you?

It shouldn't make any difference, but can you try with a static event table instead of the Bind() call?

If you can use a debugger, try tracing into the Bind() call and check if something unexpected shows up.
You could also set a breakpoint at "wxdataview_selection_changed_callback" in /src/gtk/dataview.cpp and check if the code reaches that point.
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 »

Does the "dataview" sample work for you?
I just checked the dataview sample, for some reason out of the 4 tabs, only the first tab, that is MyMusicTreeModel is firing events in the bottom section, in the wxDataViewListCtrl tab I'm not even able to toggle the check box. This is strange, If I remember correctly this sample worked before, can't guarantee but, could be wrong.
It shouldn't make any difference, but can you try with a static event table instead of the Bind() call?

If you can use a debugger, try tracing into the Bind() call and check if something unexpected shows up.
You could also set a breakpoint at "wxdataview_selection_changed_callback" in /src/gtk/dataview.cpp and check if the code reaches that point.
I tried nothing shows up, I'm out of ideas too at this point, I'm going to try to build and run this on a different machine, maybe something is broken in this machine.

EDIT: Just checked on a different machine does not work. I think its a bug then.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDataViewListCtrl on click item action not executing.

Post by ONEEYEMAN »

Hi,
What OS and GTK version do you use?
Did you build the library yourself or installed it from the repo?

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 »

ONEEYEMAN wrote: Wed Jan 13, 2021 1:14 pm Hi,
What OS and GTK version do you use?
Did you build the library yourself or installed it from the repo?

Thank you.
I am using Arch Linux, I am not really sure, how to know the GTK version, but I have download wxWidgets from the official repositories, package name was wxgtk3 which is on version 3.0.5, but if I run `pacman -Qi gtk3` I get

Code: Select all

Name            : gtk3
Version         : 1:3.24.24-2
Description     : GObject-based multi-platform GUI toolkit
Architecture    : x86_64
URL             : https://www.gtk.org/
Licenses        : LGPL
Groups          : None
Provides        : gtk3-print-backends  libgtk-3.so=0-64  libgdk-3.so=0-64  libgailutil-3.so=0-64
Depends On      : atk  cairo  libxcursor  libxinerama  libxrandr  libxi  libepoxy  gdk-pixbuf2  dconf  libxcomposite  libxdamage  pango  shared-mime-info  at-spi2-atk  wayland
                  libxkbcommon  adwaita-icon-theme  json-glib  librsvg  wayland-protocols  desktop-file-utils  mesa  cantarell-fonts  colord  rest  libcups  libcanberra  fribidi  iso-codes
                  tracker3  libcloudproviders  gtk-update-icon-cache
Optional Deps   : None
Required By     : appstream-glib  arandr  audacity  blueman  easytag  electron  electron6  emacs  firefox  gcr  gdl  geany  girara  glade  gnome-desktop  gtkmm3  gtksourceview3  gtkspell3
                  gufw  guitarix  guvcview  libdbusmenu-gtk3  libgnomekbd  libindicator-gtk3  libkeybinder3  libnautilus-extension  libnma  libxfce4ui  light-locker  lightdm-slick-greeter
                  lutris  manjaro-application-utility  manjaro-hello  matcha-gtk-theme  materia-gtk-theme  obconf  pamac-gtk  peek  polkit-gnome  syncthing-gtk  telegram-desktop
                  thunderbird  timeshift  variety  volumeicon  vscodium-bin  vte3  webkit2gtk  wxgtk3  xarchiver  xfburn  xournalpp
Optional For    : alsa-tools  appmenu-gtk-module  avahi  deadbeef  freeverb3  ghostscript  gssdp  gvfs  jre-openjdk  libinput  libreoffice-fresh  nvidia-455xx-utils  pacman-mirrors
                  qt5-base  redshift  stoken  suil  vlc  wine-staging  zbar
Conflicts With  : gtk3-print-backends
Replaces        : gtk3-print-backends<=3.22.26-1
Installed Size  : 74.60 MiB
Packager        : Jan Alexander Steffens (heftig) <[email protected]>
Build Date      : Sun 10 Jan 2021 12:44:20 AM IST
Install Date    : Mon 11 Jan 2021 03:15:03 AM IST
Install Reason  : Installed as a dependency for another package
Install Script  : Yes
Validated By    : Signature
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDataViewListCtrl on click item action not executing.

Post by ONEEYEMAN »

Hi,
what you do is run the sample and then "Ctrl+Alt+Middle click".

This will give tou the info.

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 »

ONEEYEMAN wrote: Wed Jan 13, 2021 2:25 pm Hi,
what you do is run the sample and then "Ctrl+Alt+Middle click".

This will give tou the info.

Thank you.
Ah! Nice, I didn't knew about this, does all wx applications have this feature?

Here is the info by the way,
Image
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDataViewListCtrl on click item action not executing.

Post by doublemax »

I usually don't work under Linux, but i have one VM for occasional testing.

The dataview sample doesn't have log output for item selections on the third page (wxDataViewListCtrl) by default. But i confirmed that they do get generated with a small patch to the sample.

(Around line 930)

Code: Select all

lc->Bind(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, &MyFrame::OnListValueChanged, this);
// new line below
lc->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, [this, lc](wxDataViewEvent &e) { 
    wxLogDebug("dataviewevent row %d", lc->ItemToRow(e.GetItem()));
});
But that was with a relatively new wxWidgets version from GIT. Can you test with that or at least with version 3.1.4?

Screenshot from 2021-01-13 18-48-19.png
Screenshot from 2021-01-13 18-48-19.png (18.55 KiB) Viewed 992 times
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 13, 2021 6:04 pm I usually don't work under Linux, but i have one VM for occasional testing.

The dataview sample doesn't have log output for item selections on the third page (wxDataViewListCtrl) by default. But i confirmed that they do get generated with a small patch to the sample.

(Around line 930)

Code: Select all

lc->Bind(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, &MyFrame::OnListValueChanged, this);
// new line below
lc->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, [this, lc](wxDataViewEvent &e) { 
    wxLogDebug("dataviewevent row %d", lc->ItemToRow(e.GetItem()));
});
But that was with a relatively new wxWidgets version from GIT. Can you test with that or at least with version 3.1.4?


Screenshot from 2021-01-13 18-48-19.png
I just fired up a Ubuntu VM, cloned my repository, and tried the same thing, its not working in Ubuntu as well :/

Here is the GTK info,
Image

EDIT: I tested with wx 3.1.4, with the added code you sent, it prints to the console fine.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
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 13, 2021 8:28 pm EDIT: I tested with wx 3.1.4, with the added code you sent, it prints to the console fine.
I guess this means it was/is a bug in 3.0.5. I can't find any ticket on the bug tracker about this, but then again, its search function is horrible...
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 13, 2021 9:57 pm
apoorv569 wrote: Wed Jan 13, 2021 8:28 pm EDIT: I tested with wx 3.1.4, with the added code you sent, it prints to the console fine.
I guess this means it was/is a bug in 3.0.5. I can't find any ticket on the bug tracker about this, but then again, its search function is horrible...
Should I file a new ticket?
User avatar
doublemax
Moderator
Moderator
Posts: 19160
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 13, 2021 10:07 pm
doublemax wrote: Wed Jan 13, 2021 9:57 pm
apoorv569 wrote: Wed Jan 13, 2021 8:28 pm EDIT: I tested with wx 3.1.4, with the added code you sent, it prints to the console fine.
I guess this means it was/is a bug in 3.0.5. I can't find any ticket on the bug tracker about this, but then again, its search function is horrible...
Should I file a new ticket?
You could try, but i doubt the 3.0.x path will be fixed. Can't you use a 3.1.x version?
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 13, 2021 10:09 pm
apoorv569 wrote: Wed Jan 13, 2021 10:07 pm
doublemax wrote: Wed Jan 13, 2021 9:57 pm I guess this means it was/is a bug in 3.0.5. I can't find any ticket on the bug tracker about this, but then again, its search function is horrible...
Should I file a new ticket?
You could try, but i doubt the 3.0.x path will be fixed. Can't you use a 3.1.x version?
Is it stable for use? Also I was using what was available in the default repositories, which is 3.0.x. Should I compile and install 3.1.x myself then?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDataViewListCtrl on click item action not executing.

Post by ONEEYEMAN »

Hi,
You don't have to install it.
You can just download it, build it it, and then use its wx-config for building you software. And also build and run the sample.

To build:

1. Download and unpack in for example ~/wxWidgets-3.1.4
2. cd ~/wxWidgets-3.1.4
3. mkdir buildGTK
4. cd buildGTK
5. ../configure --enable-debug --with-gtk=3 && make

Then use ~/wxWidgets-3.1.4/buildGTK/wx-config --cxxflags and ~/wxWidgets-3.1.4/buildGTK/wx-config --libs for building your software.

Thank you.

And you are certainly encouraged to use latest release version. It may not be marked as stable by *nix distributions, but it eventually will when it becomes 3.2.0 (hopefully in the next couple of month).
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 13, 2021 11:25 pm Hi,
You don't have to install it.
You can just download it, build it it, and then use its wx-config for building you software. And also build and run the sample.

To build:

1. Download and unpack in for example ~/wxWidgets-3.1.4
2. cd ~/wxWidgets-3.1.4
3. mkdir buildGTK
4. cd buildGTK
5. ../configure --enable-debug --with-gtk=3 && make

Then use ~/wxWidgets-3.1.4/buildGTK/wx-config --cxxflags and ~/wxWidgets-3.1.4/buildGTK/wx-config --libs for building your software.

Thank you.

And you are certainly encouraged to use latest release version. It may not be marked as stable by *nix distributions, but it eventually will when it becomes 3.2.0 (hopefully in the next couple of month).
I tried building it with wx version 3.1.4, it is still not working, nothing prints to the console no error, I think there is something wrong in my code. I have to review the whole project I suppose.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDataViewListCtrl on click item action not executing.

Post by ONEEYEMAN »

Hi,
Yes, something is very fishy happenning there.

Try to create the control with "this" (Browser) pointer as a parent.

If that doesn't help - strip down you code until it starts working.

And do use the:

Code: Select all

wxDVC->Bind()
code and without the ID of the control.

Thank you.
Post Reply