strange behaviour of TAB

Hi list,

on a complex form I've got a FlexGridSizer that contains 2 other FGS
for 2 lines.
The first line is casual (a serie of StaticText/TextCtrl), the 2nd
one has also 2 StaticText/TextCtrl, then 2 Checkbox, ST/TC, CB, etc

The problem is: when I move using TAB, after the first CB got the
focus, the next TAB send me back to the beginning of the first line!
So I can't reach the next CB only with the keyboard.

I don't understand as in another place I've got the same setup (but
only one CB) and TAB is working.

JY

···

--
You've got to pity New Mexico... so far from heaven and so close to
Texas.

Hi Jean-Yves,

···

On 12/04/2011 07:17 AM, Jean-Yves F. Barbier wrote:

Hi list,

on a complex form I've got a FlexGridSizer that contains 2 other FGS
for 2 lines.
The first line is casual (a serie of StaticText/TextCtrl), the 2nd
one has also 2 StaticText/TextCtrl, then 2 Checkbox, ST/TC, CB, etc

The problem is: when I move using TAB, after the first CB got the
focus, the next TAB send me back to the beginning of the first line!
So I can't reach the next CB only with the keyboard.

I don't understand as in another place I've got the same setup (but
only one CB) and TAB is working.

Based on your description I don't see why TAB doesn't work as expected. Can you make a small sample (MakingSampleApps - wxPyWiki) or at least show all the construction code for the above.

Werner

IIRC there is a problem with tabs if you don’t have a structure
something like:

Dialog/Window -> **Panel**     -> Sizer ->

Controls/Sizers…

and above you don't mention the Panel anywhere .... ?

Gadget/Steve
···

On 04/12/2011 6:17 AM, Jean-Yves F. Barbier wrote:


Hi list,
on a complex form I've got a FlexGridSizer that contains 2 other FGS
for 2 lines.
The first line is casual (a serie of StaticText/TextCtrl), the 2nd
one has also 2 StaticText/TextCtrl, then 2 Checkbox, ST/TC, CB, etc
The problem is: when I move using TAB, after the first CB got the
focus, the next TAB send me back to the beginning of the first line!
So I can't reach the next CB only with the keyboard.
I don't understand as in another place I've got the same setup (but
only one CB) and TAB is working.
JY

Hi Werner,

I attached a (not)working version (although, it needs a square
buttons picture "bttest.png" to correctly run).

JY

Client.py (50.1 KB)

···

On Sun, 04 Dec 2011 09:42:45 +0100 werner <wbruhin@free.fr> wrote:

Based on your description I don't see why TAB doesn't work as expected.
Can you make a small sample (MakingSampleApps - wxPyWiki)
or at least show all the construction code for the above.

Werner

--
They took some of the Van Goghs, most of the jewels, and all of the
Chivas!

In fact, there is a panel as this PB arise on the 1st page of a
notebook (see the example I posted in answer to Werner; might
be clumsy for the 1st part, but this is the only way I've found
to have a similar look (AND alignment!) on different screen
resolutions.

···

On Sun, 4 Dec 2011 16:23:04 +0000 Gadget/Steve <GadgetSteve@live.co.uk> wrote:

IIRC there is a problem with tabs if you don't have a structure
something like:

Dialog/Window -> *Panel *-> Sizer -> Controls/Sizers....

and above you don't mention the Panel anywhere .... ?

--
Q: What is green and comes in Brownies?
A: Boy Scouts.

Hi Jean-Yves,

Hi Werner,

I attached a (not)working version (although, it needs a square
buttons picture "bttest.png" to correctly run).

The code will not work under wxPython 2.9, i.e. it throws a few assertions/exceptions.

1. listctrl can't have wx.LC_ICON and wx.LC_REPPORT
2. there are some sizers running out of slots as you specify both rows and cols, suggest to specify one or the other
3. refactor refactor refactor - at least that's what I would do, having over a 1,000 lines of just UI definition code in one file isn't easy to work with and I doubt that any of it is reusable in this way. I would create one file per panel or something along those lines, i.e. one for the address stuff etc etc.
4. there is something in there which prevents it from shutting down correctly under 2.9, first thought it was the def __del__ but its not that.
5. you didn't mention which panel/pane is the problem case.

Werner

···

On 12/04/2011 09:53 PM, Jean-Yves F. Barbier wrote:

On Sun, 04 Dec 2011 09:42:45 +0100 > werner<wbruhin@free.fr> wrote:

The code will not work under wxPython 2.9, i.e. it throws a few
assertions/exceptions.

1. listctrl can't have wx.LC_ICON and wx.LC_REPORT

I unchecked wx.LC_ICON.

2. there are some sizers running out of slots as you specify both rows
and cols, suggest to specify one or the other

I changed row|col to 0 according to the wanted design.

3. refactor refactor refactor - at least that's what I would do, having
over a 1,000 lines of just UI definition code in one file isn't easy to
work with and I doubt that any of it is reusable in this way. I would
create one file per panel or something along those lines, i.e. one for
the address stuff etc etc.

This is the genuine wxformbuilder output I didn't touch in any way
except for the executable footer.

4. there is something in there which prevents it from shutting down
correctly under 2.9, first thought it was the def __del__ but its not that.

Yep, it also happens in 2.8.12.1-3 and I don't know why.

It is also mistake as I didn't test it enough between
modifications and noticed it after a while:(

I'll check with eric debugger to see if it can tell me where it
stucks

5. you didn't mention which panel/pane is the problem case.

This is into:
   notebook page 1 > fgSizerP1L2 > checkBoxNorSou
when you reach it, the next TAB send you back to:
   notebook page 1 > fgSizerP1L1 > textCtrlFam

Still, after these modifs it has the same behaviour.

···

On Sun, 04 Dec 2011 23:08:59 +0100 werner <wbruhin@free.fr> wrote:

--
This fortune intentionally left blank.

Ok, according to your remarks I stripped all other things but
structure, notebook and the 2 lines that failed;
however the behavior still the same:(
and it still fail to shut down correctly, so it bring a lot of PBs
I don't understand (as the structure of these 2 lines's the same as
the former 3 in the header).

Attached is this version.

JY

Client_min.py (8.68 KB)

···

On Sun, 04 Dec 2011 23:08:59 +0100 werner <wbruhin@free.fr> wrote:

--
BOFH excuse #142:
new guy cross-connected phone lines with ac power bus.

O_o I made a test:
removing the 2 contiguous CheckBoxes (labeled: "N/S" and "Dec/Deg"),
leaving them as is, and it worked!
however, as soon as I gave them wxALIGN_RIGHT it came back to the
bad behavior (WTF?)

I also confirm that behavior comes back to normal if I do the same
on the whole model (then I said to myself: nantédiou! (means:
@#!<\|):slight_smile:

So it looks much like a mean bug.

JY

···

On Sun, 04 Dec 2011 23:08:59 +0100 werner <wbruhin@free.fr> wrote:

--
Question: Is it better to abide by the rules until they're changed or
help speed the change by breaking them?

Oops I missed words :frowning:

O_o I made a test:
removing the 2 contiguous CheckBoxes (labeled: "N/S" and "Dec/Deg"),

replacing by two new ones and

···

On Mon, 5 Dec 2011 00:19:46 +0100 "Jean-Yves F. Barbier" <12ukwn@gmail.com> wrote:

leaving them as is, and it worked!
however, as soon as I gave them wxALIGN_RIGHT it came back to the
bad behavior (WTF?)

I also confirm that behavior comes back to normal if I do the same
on the whole model (then I said to myself: nantédiou! (means:
@#!<\|):slight_smile:
So it looks much like a mean bug.

JY

--
Don't look now, but your mother is having sex with a horse.

The code will not work under wxPython 2.9, i.e. it throws a few
assertions/exceptions.

1. listctrl can't have wx.LC_ICON and wx.LC_REPORT

I unchecked wx.LC_ICON.

2. there are some sizers running out of slots as you specify both rows
and cols, suggest to specify one or the other

I changed row|col to 0 according to the wanted design.

3. refactor refactor refactor - at least that's what I would do, having
over a 1,000 lines of just UI definition code in one file isn't easy to
work with and I doubt that any of it is reusable in this way. I would
create one file per panel or something along those lines, i.e. one for
the address stuff etc etc.

This is the genuine wxformbuilder output I didn't touch in any way

As always, generated_code == yucky_code.

4. there is something in there which prevents it from shutting down
correctly under 2.9, first thought it was the def __del__ but its not that.

Yep, it also happens in 2.8.12.1-3 and I don't know why.

Because you create a dialog but don't destroy it, so there are top-level windows that continue to exist, so the MainLoop does not exit.

···

On 12/4/11 2:38 PM, Jean-Yves F. Barbier wrote:

On Sun, 04 Dec 2011 23:08:59 +0100 > werner<wbruhin@free.fr> wrote:

--
Robin Dunn
Software Craftsman

What exactly was broken? Can you make a sample that shows just the broken parts?

···

On 12/4/11 3:22 PM, Jean-Yves F. Barbier wrote:

On Mon, 5 Dec 2011 00:19:46 +0100 > "Jean-Yves F. Barbier"<12ukwn@gmail.com> wrote:

Oops I missed words :frowning:

O_o I made a test:
removing the 2 contiguous CheckBoxes (labeled: "N/S" and "Dec/Deg"),

replacing by two new ones and

leaving them as is, and it worked!

--
Robin Dunn
Software Craftsman

Here you're, this one's "funny" as it stucks completely once you've
reached the cbBLOCKING.

ASA you remove wxALIGN_RIGHT everything's get back to normal.

JY

test_cb_align_right.py (6.05 KB)

···

On Sun, 04 Dec 2011 18:53:42 -0800 Robin Dunn <robin@alldunn.com> wrote:

What exactly was broken? Can you make a sample that shows just the
broken parts?

--
Contest void where prohibited by law.

You should always mention platform (GTK) and wx version (2.8.x) when reporting problems. This issue has been fixed in the 2.9 series.

···

On 12/4/11 7:15 PM, Jean-Yves F. Barbier wrote:

On Sun, 04 Dec 2011 18:53:42 -0800 > Robin Dunn<robin@alldunn.com> wrote:

What exactly was broken? Can you make a sample that shows just the
broken parts?

Here you're, this one's "funny" as it stucks completely once you've
reached the cbBLOCKING.

ASA you remove wxALIGN_RIGHT everything's get back to normal.

--
Robin Dunn
Software Craftsman

Debian Linux sid (unstable), wx 2.8.12.1-3

I could flip to 2.9 but only if it compiles correctly under stable
as I develop under unstable but the pgm will run on stable (and if
the tarball integrates debian scripts, to avoid breaking
dependencies).

JY

···

On Sun, 04 Dec 2011 19:25:48 -0800 Robin Dunn <robin@alldunn.com> wrote:

You should always mention platform (GTK) and wx version (2.8.x) when
reporting problems. This issue has been fixed in the 2.9 series.

--
"Let's show this prehistoric bitch how we do things downtown!"
    -- The Ghostbusters

Hi Jean-Yves,

...

3. refactor refactor refactor - at least that's what I would do, having

over a 1,000 lines of just UI definition code in one file isn't easy to
work with and I doubt that any of it is reusable in this way. I would
create one file per panel or something along those lines, i.e. one for
the address stuff etc etc.

This is the genuine wxformbuilder output I didn't touch in any way
except for the executable footer.

This shouldn't prevent you from breaking it down into multiple things right from the start with wxfb.

I.e. create in wxfb a module based on wx.Panel with all the address stuff, then in your dialog you use this for both address blocks etc etc etc.

4. there is something in there which prevents it from shutting down
correctly under 2.9, first thought it was the def __del__ but its not that.

What is the reason to have the def __del__ in there, is this another wxfb "standard".

Yep, it also happens in 2.8.12.1-3 and I don't know why.

I see Robin caught on to it that the dialog is never closed.

Instead of your test code you could put this at the end of your file for testing.

···

On 12/04/2011 11:38 PM, Jean-Yves F. Barbier wrote:

#----------------------------------------------------------------------
if __name__ == '__main__':
     # this will only execute if you run this file, ideal for testing
     # and can be left in the code without issues
     import wx.lib.mixins.inspection as wit

     app = wit.InspectableApp(False)

     dlg = MyDialog2(None)
     try:
         dlg.ShowModal()
     finally:
         dlg.Destroy()
     app.MainLoop()

When running it press "ctrl-alt-i" and find out more about the WIT on the wiki.

Werner

Hi Werner

> This is the genuine wxformbuilder output I didn't touch in any way
> except for the executable footer.
>
This shouldn't prevent you from breaking it down into multiple things
right from the start with wxfb.

I.e. create in wxfb a module based on wx.Panel with all the address
stuff, then in your dialog you use this for both address blocks etc etc etc.

Hon-hon, I must find how to do that...

>> 4. there is something in there which prevents it from shutting down
>> correctly under 2.9, first thought it was the def __del__ but its not that.
What is the reason to have the def __del__ in there, is this another
wxfb "standard".

Yep: I just added the footer.

> Yep, it also happens in 2.8.12.1-3 and I don't know why.
I see Robin caught on to it that the dialog is never closed.

This is solved since:
* I pulled up wxALIGN_RIGHT
* I simplified the design (to much useless sizers)

Instead of your test code you could put this at the end of your file for
testing.
#----------------------------------------------------------------------
if __name__ == '__main__':
     # this will only execute if you run this file, ideal for testing
     # and can be left in the code without issues
     import wx.lib.mixins.inspection as wit

     app = wit.InspectableApp(False)

Didn't knew about this one.

     dlg = MyDialog2(None)
     try:
         dlg.ShowModal()
     finally:
         dlg.Destroy()
     app.MainLoop()

When running it press "ctrl-alt-i" and find out more about the WIT on
the wiki.

Can't find it in: http://wiki.wxpython.org/TitleIndex#idx-W

JY

···

On Mon, 05 Dec 2011 11:23:00 +0100 werner <wbruhin@free.fr> wrote:
--
This is National Non-Dairy Creamer Week.

Hi Jean-Yves,

Hi Werner

This is the genuine wxformbuilder output I didn't touch in any way
except for the executable footer.

This shouldn't prevent you from breaking it down into multiple things
right from the start with wxfb.

I.e. create in wxfb a module based on wx.Panel with all the address
stuff, then in your dialog you use this for both address blocks etc etc etc.

Hon-hon, I must find how to do that...

I am lately moving from UI designer code (Boa Constructor in my case) to hand coding using wx.lib.sized_controls and do a "panel at the time" with the test code at the end to check out layout etc. Over time I am building little scripts which further help reduce the repetitive code, something I got out of the books (both Robin's and Cody's). If you had asked me a year ago to do UI's that way I wouldn't have agreed but today it is a different story:-) .

...

Can't find it in: http://wiki.wxpython.org/TitleIndex#idx-W

http://wiki.wxpython.org/Widget%20Inspection%20Tool

Werner

···

On 12/05/2011 12:44 PM, Jean-Yves F. Barbier wrote:

On Mon, 05 Dec 2011 11:23:00 +0100 > werner<wbruhin@free.fr> wrote:

I understand all the good that comes from it, but this way you only
have the visual at the end. I'm too young to wx to do that at once.

JY

···

On Mon, 05 Dec 2011 13:18:53 +0100 werner <wbruhin@free.fr> wrote:

I am lately moving from UI designer code (Boa Constructor in my case) to
hand coding using wx.lib.sized_controls and do a "panel at the time"
with the test code at the end to check out layout etc. Over time I am
building little scripts which further help reduce the repetitive code,
something I got out of the books (both Robin's and Cody's). If you had
asked me a year ago to do UI's that way I wouldn't have agreed but today
it is a different story:-) .

--
When I was young we didn't have MTV; we had to take drugs and go to
concerts. -- Steven Pearl