Page 1 of 1

wxDataViewCtrl - Finish Editing

Posted: Wed Dec 05, 2018 11:23 am
by UVT
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.

Re: wxDataViewCtrl - Finish Editing

Posted: Wed Dec 05, 2018 4:11 pm
by ONEEYEMAN
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.

Re: wxDataViewCtrl - Finish Editing

Posted: Wed Dec 05, 2018 4:24 pm
by Manolo
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.

Re: wxDataViewCtrl - Finish Editing

Posted: Thu Dec 06, 2018 8:22 am
by UVT
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.

Re: wxDataViewCtrl - Finish Editing

Posted: Fri Dec 07, 2018 8:25 am
by UVT
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