wxDataViewCtrl - Finish Editing  [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.
UVT
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Dec 05, 2018 10:52 am

wxDataViewCtrl - Finish Editing

Postby UVT » Wed Dec 05, 2018 11:23 am

Hi everbody,

this is my first entry in this forum, but I've been finding a lot of solutions and useful suggestions in it durring the previous months. Therefore I would like to thank everbody for making my work with wxwidgets much easier.

Nevertheless I've been having a problem regarding wxDataViewCtrl lately.
Let's take a look into the dataview sample. If you left click for example on the element "German Requiem" in "MyMusicTreeModel" and press F2 then you can rename this element. If you then process a left-click the editing will be terminated and the other element will be highlighted.
If you do the same with a right-click you would expect the same behaviour plus a context menu. Unfortunately the editing is not being terminated, but still the context menu appears, which I think is an unnatural behavior.
Since in my application the context menu also has an entry for renaming I even got worse scenarios where several elements where open for editing at the same time.

Everything that I need, is to terminate the editing when a EVT_DATAVIEW_ITEM_CONTEXT_MENU is fired.

This could easily be done with a simple function

Code: Select all

void wxDataViewCtrl::FinishEditing(){
   m_clientArea->FinishEditing();
}


Is there a reason why this function does not exist even though the opposite can be done with "wxDataViewCtrl::EditItem"? Or could this be a useful addition?

I am really looking forward to your replies and thank you in advance.

ps: I'm using wxWidgets 3.0.4 on a windows 7 machine.

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

Re: wxDataViewCtrl - Finish Editing  [SOLVED]

Postby ONEEYEMAN » Wed Dec 05, 2018 4:11 pm

Hi,
This forum is by users for users.
Those type of questions better asked on the wx-dev mailing list, where you can reach core developers or wx-users where you can talk to both people who done a lot of work with the library and the developers.

That way you can get more out of you question.

Thank you.

Manolo
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 611
Joined: Mon Apr 30, 2012 11:07 pm

Re: wxDataViewCtrl - Finish Editing

Postby Manolo » Wed Dec 05, 2018 4:24 pm

There exists virtual bool wxDataViewRenderer::FinishEditing() and virtual void wxDataViewRenderer::CancelEditing()

Looking into wx sources they do what their names tell. The difference is getting or not the current value in control.

UVT
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Dec 05, 2018 10:52 am

Re: wxDataViewCtrl - Finish Editing

Postby UVT » Thu Dec 06, 2018 8:22 am

Thank you for your quick responses.

Oneeyeman, thanks, I didn't know that. I think I should follow your advice.

Manolo, when I call

Code: Select all

m_clientArea->FinishEditing();
in the code of wxDataViewCtrl this gets processed to

Code: Select all

wxDataViewRenderer::FinishEditing()


Maybe my problem is, that I have no clue how I can get access to this function without manipulation the code of wxDataViewCtrl.

UVT
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Dec 05, 2018 10:52 am

Re: wxDataViewCtrl - Finish Editing

Postby UVT » Fri Dec 07, 2018 8:25 am

ONEEYEMAN wrote:Hi,
This forum is by users for users.
Those type of questions better asked on the wx-dev mailing list, where you can reach core developers or wx-users where you can talk to both people who done a lot of work with the library and the developers.

That way you can get more out of you question.

Thank you.


I've contacted the mailing list. I got a nice and very quick response and changes concerning the more important part of my request have already been made.
https://github.com/wxWidgets/wxWidgets/pull/1052

Thank you


Return to “C++ Development”

Who is online

Users browsing this forum: No registered users and 20 guests