wxTextCtrl behavior has changed.

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.
stychokiller
Earned a small fee
Earned a small fee
Posts: 12
Joined: Mon Mar 23, 2009 10:21 am
Location: Slayton, MN, USA

wxTextCtrl behavior has changed.

Post by stychokiller »

Under V2.8.12, wxTextCtrls allowed me to press the arrow keys, delete and backspace inside the widget, 8)
but under V3.0.2 these keys are being ignored! :cry:

This is how the control is being created:

FieldsTC = new wxTextCtrl( mainFrame, ID_FieldsTC, wxEmptyString, wxDefaultPosition,
wxSize(1000, -1), wxTE_PROCESS_ENTER|wxTE_LEFT|wxSIMPLE_BORDER );

Here's the entry in the event table:

EVT_TEXT_ENTER( ID_FieldsTC, DbaseEditorGen::OnFieldsTCTextEntered )

Is there some new flag I should supply to the new wxTextCtrl() function to enable editing keys inside the control? :?:
Time flies like an Arrow. Fruit flies like a banana.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxTextCtrl behavior has changed.

Post by ONEEYEMAN »

Hi,
You shouldn't need to do anything - those keys will be handled by the OS.
What OS/version you are running? Can you reproduce the behavior in the text sample?

Thank you.
stychokiller
Earned a small fee
Earned a small fee
Posts: 12
Joined: Mon Mar 23, 2009 10:21 am
Location: Slayton, MN, USA

Re: wxTextCtrl behavior has changed.

Post by stychokiller »

I'm currently using Linux Mint V17.1 on my PC.
I assume the text sample you're referring to is located in wxWidgets/samples/text.
I compiled the samples/text executable and it does indeed allow arrows, backspace, delete. :roll:
I don't get it. :x
Time flies like an Arrow. Fruit flies like a banana.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxTextCtrl behavior has changed.

Post by ONEEYEMAN »

OK, so now all you need is to look for the difference between your code and the sample.
Are you using any hook events? Are you using any char/key events? Did you call event.Skip() for non-wxCommand events?

Thank you.
stychokiller
Earned a small fee
Earned a small fee
Posts: 12
Joined: Mon Mar 23, 2009 10:21 am
Location: Slayton, MN, USA

Re: wxTextCtrl behavior has changed.

Post by stychokiller »

Only the following functions call event.Skip()

IMPLEMENT_CLASS( DbaseEditorGen, wxFrame )

BEGIN_EVENT_TABLE( DbaseEditorGen, wxFrame )

EVT_CLOSE( DbaseEditorGen::OnCloseWindow ) // this one just cleans up and exits the program.

EVT_LISTBOX( ID_DbasesLB, DbaseEditorGen::OnDbasesLBSelected )
EVT_LISTBOX( ID_TablesLB, DbaseEditorGen::OnTablesLBSelected )
EVT_GRID_CELL_LEFT_CLICK( DbaseEditorGen::OnFieldsGridClicked )

EVT_TEXT_ENTER( ID_DBaseTC, DbaseEditorGen::OnDBaseTCTextUpdated )
EVT_TEXT_ENTER( ID_TableTC, DbaseEditorGen::OnTableTCTextUpdated )
EVT_TEXT_ENTER( ID_FieldsTC, DbaseEditorGen::OnFieldsTCTextUpdated )

EVT_MENU( ID_NEW_MI, DbaseEditorGen::OnNewMIClicked )
EVT_MENU( ID_OPEN_MI, DbaseEditorGen::OnOpenMIClicked )
EVT_MENU( ID_SAVE_MI, DbaseEditorGen::OnSaveMIClicked )
EVT_MENU( ID_GEN_MI, DbaseEditorGen::OnGenerateMIClicked )
EVT_MENU( ID_HELP_MI, DbaseEditorGen::OnHelpMIClicked )
EVT_MENU( ID_QUIT_MI, DbaseEditorGen::OnQuitMIClicked ) // this one just cleans up and exits the program.

END_EVENT_TABLE()

I don't know what hook events are, and neither do I use Char/Key events. :?
The GUI code was generated by dialogBlocks, which does things slightly differently
than code::Blocks. I wrote a small test program to just check the TextCtrl operation,
and it worked correctly. Since even the wxDialogs are not allowing editing of strings,
I might have a problem with the wxFrame creation code, but there is nothing in it that
I haven't used before.
Time flies like an Arrow. Fruit flies like a banana.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxTextCtrl behavior has changed.

Post by ONEEYEMAN »

Hi,
Like I said - try to compare the code in question with the code in the sample or the test code you wrote.
If that's too hard, try to bring the pieces of you code to the sample and see what function breaks the code.

I'm afraid this is the only way.

BTW all you EVT_TEXT_ENTER() handlers have only one exit point, correct?

Thank you.
stychokiller
Earned a small fee
Earned a small fee
Posts: 12
Joined: Mon Mar 23, 2009 10:21 am
Location: Slayton, MN, USA

Re: wxTextCtrl behavior has changed.

Post by stychokiller »

You know what, I was able to re-generate the entire GUI using wxGlade in 2 days! 8) Sure beats fooling around with either
dialogBlocks or code::Blocks for over 10 days, trying to fix a problem within wxWidgets 3.0.2 :evil:
wxGlade currently does not use V3.0.2, and there was NO problem using editing keys inside a TextCtrl =D>
As far as I'm concerned, "my problem" (more like wxWidgets3.0.2's problem!) is fixed.
Time flies like an Arrow. Fruit flies like a banana.
ktmpal
Earned a small fee
Earned a small fee
Posts: 18
Joined: Thu Dec 13, 2012 7:33 pm

Re: wxTextCtrl behavior has changed.

Post by ktmpal »

I also switched to version 3.x from 2.8 and my wxTextCtrl developed the edit key (backspace, etc) problem. In my case however, the sample code has the same problem, e.g. the 2.8 sample works as expected while the 3.x does not. What happens is when an edit key is press, the dialog containing the control loses focus. If the dialog is clicked, the edit takes effect.
I am running Debian 9.1 within VirtualBox.

There are many post about loosing focus, If my dialog regained focus it might fix this but how to do this is not clear to me.
I read many posts and one mentioned that it has to do with the OS. How can that be?
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxTextCtrl behavior has changed.

Post by DavidHart »

Hi,
2.8 sample works as expected while the 3.x does not. What happens is when an edit key is press, the dialog containing the control loses focus.
That's strange. I just tested the 'text' sample in a debian stretch vbox guest and couldn't make it fail.

I'm using wx3.1.2. Which wx version failed for you? And is it happening in one particular textctrl or all of them?

Regards,

David
ktmpal
Earned a small fee
Earned a small fee
Posts: 18
Joined: Thu Dec 13, 2012 7:33 pm

Re: wxTextCtrl behavior has changed.

Post by ktmpal »

The Debian 9.1 released version (3.0.2) and my built version, 3.1.2. The text sample and the dialogs sample both have the same problem on my platform.

Thanks for looking at this.
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxTextCtrl behavior has changed.

Post by DavidHart »

I'm using KDE, though I'd not expect the DE to be relevant. One thing that might affect it though is your locale etc: see this bug-report.

Does that apply to you?
ktmpal
Earned a small fee
Earned a small fee
Posts: 18
Joined: Thu Dec 13, 2012 7:33 pm

Re: wxTextCtrl behavior has changed.

Post by ktmpal »

Possibly of importance: my version 3 install is wxWidgets3.1.2 while my version 2 install is wxGTK2.8.12. I have always used the GTK code set but it doesn't seem to be available for version 3. I assumed there was a consolidation or does the GTK variant release lag?
ktmpal
Earned a small fee
Earned a small fee
Posts: 18
Joined: Thu Dec 13, 2012 7:33 pm

Re: wxTextCtrl behavior has changed.

Post by ktmpal »

On 2nd thought, I do have a build of wxWidgets2.8.12 and the sample code also works fine.
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxTextCtrl behavior has changed.

Post by DavidHart »

Unless you went out of your way to create a wxX11 or wxQT build, it will still be wxGTK.

You can be sure by running a wx program (in this case, 'text') and doing Ctl-Alt-Middleclick inside it. The resulting dialog will very likely mention GTK.
ktmpal
Earned a small fee
Earned a small fee
Posts: 18
Joined: Thu Dec 13, 2012 7:33 pm

Re: wxTextCtrl behavior has changed.

Post by ktmpal »

Sorry I missed your previous post. This bug report could definitely be related but I did not grasp the fix.

My environment is MATE
Post Reply