wxDataViewEvent.GetColumn() returns -1

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
tengai
Knows some wx things
Knows some wx things
Posts: 32
Joined: Fri May 11, 2018 6:49 pm

wxDataViewEvent.GetColumn() returns -1

Post by tengai »

Hello,

I've ported my wx app to linux and I'm having difficulty getting double click actions to work with wxDataViewCtrl.

A double click in a DataView column is to generate a wxDataViewEvent object for: EVT_DATAVIEW_ITEM_ACTIVATED

The docs for wxDataViewEvent.GetColumn() says, "...or -1 if no column field was set by the event emitter. "

Can someone please explain what "set by the event emitter" means?

The same code, wxDataViewEvent.GetColumn() works correctly on Windows, the correct column number is returned.

Other discovery on Linux shows, wxDataViewEvent.GetDataViewColumn() returns NULL. This suggest the wxDataViewEvent isn't initialized correctly.

Any insight is appreciated.

Thanks,

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

Re: wxDataViewEvent.GetColumn() returns -1

Post by doublemax »

The docs for wxDataViewEvent.GetColumn() says, "...or -1 if no column field was set by the event emitter. "
Can someone please explain what "set by the event emitter" means?
That's another was of saying that this information might not be available on all platforms - as you just found out.

If you really need the column, you can calculate it yourself using the mouse position and the widths of the columns.
Use the source, Luke!
tengai
Knows some wx things
Knows some wx things
Posts: 32
Joined: Fri May 11, 2018 6:49 pm

Re: wxDataViewEvent.GetColumn() returns -1

Post by tengai »

Can you provide some insight as to why this behavior doesn't work on Linux?
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDataViewEvent.GetColumn() returns -1

Post by doublemax »

tengai wrote:Can you provide some insight as to why this behavior doesn't work on Linux?
Not really. But i know that under Linux/GTK a native control is used, while under Windows it's a generic implementation. I guess the native version just doesn't provide this information.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDataViewEvent.GetColumn() returns -1

Post by ONEEYEMAN »

Hi,
Looking at the code lines 4462-4469, it looks like the functionality is provided but disabled (Notice the parameter is set as WXUNUSED()).

I'd ask the question on the wx-dev ML andmaybe Paul or Vadim give more insight, why this is the case.

Thank you.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDataViewEvent.GetColumn() returns -1

Post by ONEEYEMAN »

Hi,
For anybody interested - I sent an E-mail to the wx-dev ML about this issue.

Thank you.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDataViewEvent.GetColumn() returns -1

Post by ONEEYEMAN »

Hi,
FYI, this has been fixed today.
The "column" parameter is now available in the actiavted event of wxDVC.

All 3 major platforms - MSW, *nix/GTK and OSX/Cocoa have this functionality available.

Thank you.
Post Reply