Tabbing in a scrollpanel

Python 3.8.6, wxpython 4.1.0, windows 10 and linux

I’m wondering if I have written a bug in my code or I found a bug of some sort. BTW I believe this issue appeared after upgrading to 4.1 from 4.0.7. Of course I could be wrong since I just discovered this issue.

I created a wx.Notebook with 8 pages. On one of the pages I have many wx.TextCtrl items. So many I was required to add a ScrolledWindow.

The issue is - as I tab though the wx.TextCtrl items the screen does NOT scroll. If I use the scroll bar the screen does scroll correctly. But tabbing does not force the scroll to happen. Of course this use to work.

So this is what I have

a page of the wx.Notebook with a panel

Added a header wx.panel to the page panel.
Added scroll panel to the page panel.
In the scroll panell added two panels
in panel 1 lots of wx.TextCtrl items with static text
in panel 2 lots of wx.TextCtrl items with static text

The reason I added the two panels to the scroll panel was to force the tabbing in each of the panels to process the tab independent of the the other panel. But I don’t do anything with the event keys. But I do bind a few of the value changes - i.e. confirm the date is valid, etc…

So the question is – has anyone run across this issue. If no one has – anybody have a suggestion where to start looking. I have been trying to debug this without much success. Small example code appears to work but I have not built anything as large as the actual code.

Thanks for reading!

Johnf

1 Like

I have a Frame, Buttons & ScrolledWindow on a panel in it on windows (all newest) and it always worked with or without TextCtrls: cursor in last TextCtrl entry and ENTER also moves (I think the ScrolledWindow is lovely: if you haven’t got enough room just scroll the whole stuff a bit)

That is what I am doing and I am experiencing the issue of the tab key not scrolling the scrollpanel.

Best is you upload the relevant skeleton of your code and we all have a look at it :partying_face:
(the tab only works per panel, so the panels inside the scrolled window will obviously kill the tabbed scroll; but you may catch it and hand it over)

The code in question has been around for over 10 years and I wonder if what you said is correct - the panels prevent the tab event from effecting the scroll panel. Of course I could be wrong and I will create a test case. I hope you are wrong because I wonder how I can prevent tab events from moving left to right when I want to travel in the vertical (top to bottom). I wonder if the sizers might help. The test cases I used in the past were only one panel.

Well, that Sizers have got anything to do with is a bit on the wild side…

I expect that the issue is due to the panel between the scrolledpanel and the text widgets. The ScrolledPanel does its work by catching the child focus events and then trying to scroll that child into view. It’s probably trying to scroll the panel into view, but if it’s larger than the viewable space it can’t do anything.

The default tab order is determined by the order than the widgets are created. So if you want to make the tab order to move down columns od widgets instead of across rows then you should create them in that order. You can also change the order after creation using the Move[After|Before]InTabOrder methods.

If that won’t work for your use case then my suggestion would be to use two scrolled panels side-by-side instead of two panels in a scrolled panel.

1 Like

So I need two (2) columns - that is why I used two (2) panels on the scrollpanel. I’m thinking I can use two vertical sizers in a horizontal sizer to setup the two columns.

Thanks Robin! I will try to get this to work.
Johnf