expanding panel that turns to a scrolledpanel?

I have a situation in which I have a custom dialog with roughly this hierarchy:

---- Dialog

— background panel

— panel2 (the one in question here)

panel2 will house a variable number of other widgets that will stack vertically.

What I had been doing is making the height of Dialog change to accommodate however many things are stacked vertically; I like that effect, as it gives a clean and expected user experience. I realize now, though, that it is possible that users could have so many things stacked vertically that the height of Dialog will be greater than the height of the user’s screen–can’t have that.

So I thought I could keep this approach for cases where the amount stacked vertically is under some critical value that doesn’t make the whole Dialog to tall…but then, if there are too many widgets stacked vertically, switch the panel2 to a scrolled panel, so that now the user could scroll to the lowest widgets within panel2.

First, does this approach seem like a decent user experience?

Second, can this be done reasonably easily/robustly? Any advice? (I am trying now, but encountering some issues that I can describe if necessary.)

Thanks!

Che

So I thought I could keep this approach for cases where the amount stacked
vertically is under some critical value that doesn't make the whole Dialog
to tall...but then, if there are too many widgets stacked vertically,
switch the panel2 to a scrolled panel, so that now the user could scroll
to the lowest widgets within panel2.

First, does this approach seem like a decent user experience?

Che,

   I, too, will need a scrolled panel when the 'stack' of displayed widgets is
longer than the window height. My initial thinking is to use a scrolled
panel from the beginning. What I do not -- yet -- know is whether the
scrolled panel can be configured to display the vertical scroll 'thumb' only
after the contents reach a certain length.

   In my application, I want to use either a ListCtrl or Grid (depending the
data to be displayed), and the number of rows will soon exceed the visual
space available.

Second, can this be done reasonably easily/robustly? Any advice? (I am
trying now, but encountering some issues that I can describe if necessary.)

   I, too, am interested in the answer to this question.

Rich

···

On Sun, 20 Jul 2014, C M wrote:

Hi Rich,

···

I, too, will need a scrolled panel when the ‘stack’ of displayed widgets is

longer than the window height. My initial thinking is to use a scrolled

panel from the beginning. What I do not – yet – know is whether the

scrolled panel can be configured to display the vertical scroll ‘thumb’ only

after the contents reach a certain length.

In my application, I want to use either a ListCtrl or Grid (depending the

data to be displayed), and the number of rows will soon exceed the visual

space available.

I think that both those controls automatically incorporate scrolling when the items exceed the display area, don’t they? I know with my use of ListCtrl it does.

Che

Hi Che,

···

On 7/20/2014 18:12, C M wrote:

I have a situation in which I have a custom dialog with roughly this hierarchy:

---- Dialog
   --- background panel
        --- panel2 (the one in question here)

panel2 will house a variable number of other widgets that will stack vertically.

What I had been doing is making the height of Dialog change to accommodate however many things are stacked vertically; I like that effect, as it gives a clean and expected user experience. I realize now, though, that it is possible that users could have so many things stacked vertically that the height of Dialog will be greater than the height of the user's screen--can't have that.

So I thought I could keep this approach for cases where the amount stacked vertically is under some critical value that doesn't make the whole Dialog to tall...but then, if there are too many widgets stacked vertically, switch the panel2 to a scrolled panel, so that now the user could scroll to the lowest widgets within panel2.

First, does this approach seem like a decent user experience?

Second, can this be done reasonably easily/robustly? Any advice? (I am trying now, but encountering some issues that I can describe if necessary.)

Why not always use a ScrolledPanel for your panel2? The scroll bars only show up when needed.

Werner

Second, can this be done reasonably easily/robustly? Any advice? (I am

trying now, but encountering some issues that I can describe if necessary.)

Why not always use a ScrolledPanel for your panel2? The scroll bars only
show up when needed.

Hi Werner,
Yes, I am trying that, but it seems that now that I changed what was a
wx.Panel into a ScrolledPanel, the overall behavior is different, and not
in a way that I want.

It used to be, when it was a panel, that when I added a new "row" (of
widgets) to the panel into a FlexGridSizer, I would then also call a
function that would change the height of the dialog by checking the panel's
height and adjusting that much.

But if I used a ScrolledPanel, as I add each new widget row, the height of
the ScrolledPanel is not changing. It stays the same, but provides scroll
bars once the combined height of the widget rows exceeds the visible area.
Since the height of the scrolledPanel stays the same, the Dialog doesn't
ever get taller.

I sort of want the best of both worlds: I want the Dialog to get taller
*up to a point* (that point being the height of the user's screen or
perhaps just a reasonable height that I hard code), and then, for any
additional widget rows, I want it to switch over into scrolled mode.

The reason here is that growing the dialog *looks cleaner* than suddenly
appearing scroll bars, but growing it too tall makes it impossible to use
(so at that point, let the panel scroll).

So is there something I can do to allow the ScrolledPanel to change its
height up to a point? What's special about ScrolledPanel that it is not
growing as a panel does? Does it somehow veto that behavior of a normal
panel, and, if so, can I anti-veto that until it gets too tall?

Hope this all makes any sense! :smiley:

Che

···

Werner

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I think I had similar issues, but I don’t recall what solved it for
me. It is either ‘sizer’, most likely, but it could also be my use
of wx.lib.agw.persist
BTW, have you seen this:
wxpython.org/Phoenix/docs/html/Scrolled.html
Do you have a sizer to which you add the ScrolledPanel?
Werner

···

Hi Che,

  On 7/22/2014 6:04, C M wrote:
                Second, can this be done reasonably easily/robustly?

Any advice? (I am trying now, but encountering some
issues that I can describe if necessary.)

          Why not always use a ScrolledPanel for your panel2?  The

scroll bars only show up when needed.

Hi Werner,

          Yes, I am trying that, but it seems that now that I

changed what was a wx.Panel into a ScrolledPanel, the
overall behavior is different, and not in a way that I
want.

          It used to be, when it was a panel, that when I added a

new “row” (of widgets) to the panel into a FlexGridSizer,
I would then also call a function that would change the
height of the dialog by checking the panel’s height and
adjusting that much.

          But if I used a ScrolledPanel, as I add each new widget

row, the height of the ScrolledPanel is not changing. It
stays the same, but provides scroll bars once the combined
height of the widget rows exceeds the visible area. Since
the height of the scrolledPanel stays the same, the Dialog
doesn’t ever get taller.

          I sort of want the best of both worlds:  I want the

Dialog to get taller up to a point (that point being the
height of the user’s screen or perhaps just a reasonable
height that I hard code), and then, for any additional
widget rows, I want it to switch over into scrolled mode.

          The reason here is that growing the dialog *looks

cleaner* than suddenly appearing scroll bars, but growing
it too tall makes it impossible to use (so at that point,
let the panel scroll).

          So is there something I can do to allow the ScrolledPanel

to change its height up to a point? What’s special about
ScrolledPanel that it is not growing as a panel does?
Does it somehow veto that behavior of a normal panel, and,
if so, can I anti-veto that until it gets too tall?

Hope this all makes any sense! :smiley:

Hi Che,

   Second, can this be done reasonably easily/robustly? Any advice? (I

am trying now, but encountering some issues that I can describe if
necessary.)

Why not always use a ScrolledPanel for your panel2? The scroll bars
only show up when needed.

Hi Werner,
Yes, I am trying that, but it seems that now that I changed what was a
wx.Panel into a ScrolledPanel, the overall behavior is different, and not
in a way that I want.

It used to be, when it was a panel, that when I added a new "row" (of
widgets) to the panel into a FlexGridSizer, I would then also call a
function that would change the height of the dialog by checking the panel's
height and adjusting that much.

But if I used a ScrolledPanel, as I add each new widget row, the height
of the ScrolledPanel is not changing. It stays the same, but provides
scroll bars once the combined height of the widget rows exceeds the visible
area. Since the height of the scrolledPanel stays the same, the Dialog
doesn't ever get taller.

I sort of want the best of both worlds: I want the Dialog to get taller
*up to a point* (that point being the height of the user's screen or
perhaps just a reasonable height that I hard code), and then, for any
additional widget rows, I want it to switch over into scrolled mode.

The reason here is that growing the dialog *looks cleaner* than suddenly
appearing scroll bars, but growing it too tall makes it impossible to use
(so at that point, let the panel scroll).

So is there something I can do to allow the ScrolledPanel to change its
height up to a point? What's special about ScrolledPanel that it is not
growing as a panel does? Does it somehow veto that behavior of a normal
panel, and, if so, can I anti-veto that until it gets too tall?

Hope this all makes any sense! :smiley:

   I think I had similar issues, but I don't recall what solved it for
me. It is either 'sizer', most likely, but it could also be my use of
wx.lib.agw.persist

BTW, have you seen this:
wxpython.org/Phoenix/docs/html/Scrolled.html

Yes, but it didn't help me.

Do you have a sizer to which you add the ScrolledPanel?

Yes, a FlexGridSizer.

Thanks,
Che

···

On Tue, Jul 22, 2014 at 2:56 AM, Werner <wernerfbd@gmx.ch> wrote:

On 7/22/2014 6:04, C M wrote:


Hhm, with the sample sample attached it is not needed as long as it
is the only widget in the frame.
If I have the range set to 2 there are are no scrollbars and if it
is higher the scrollbars show up and if I manually resize the frame
they go away.
What is missing to what you are doing in your code?
Werner

scrolledexampleindoc.py (1.06 KB)

···

Hi Che,

  On 7/22/2014 9:09, C M wrote:
        On Tue, Jul 22, 2014 at 2:56 AM,

Werner wernerfbd@gmx.ch
wrote:

Hi Che,

                On 7/22/2014 6:04, C M wrote:
            Do you have a sizer

to which you add the ScrolledPanel?

Yes, a FlexGridSizer.

Hi Werner,

Maybe I’m misunderstanding, but what you attached seems to just show how to use ScrolledPanel in the normal way. That I can do. I just don’t want to use it in the normal way, but in the perhaps unusual way I described in the previous message.

Maybe I will make a sample runnable sample that shows the situation and attach it later…stay tuned…

Che

···

On Tue, Jul 22, 2014 at 3:57 AM, Werner wernerfbd@gmx.ch wrote:

Hi Che,

  On 7/22/2014 9:09, C M wrote:

Hhm, with the sample sample attached it is not needed as long as it

is the only widget in the frame.

If I have the range set to 2 there are are no scrollbars and if it

is higher the scrollbars show up and if I manually resize the frame
they go away.

What is missing to what you are doing in your code?



Werner

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

        On Tue, Jul 22, 2014 at 2:56 AM,

Werner wernerfbd@gmx.ch
wrote:

Hi Che,

                On 7/22/2014 6:04, C M wrote:
            Do you have a sizer

to which you add the ScrolledPanel?

Yes, a FlexGridSizer.

I think I understood what you wanted… give this example a try… I didn’t clean it up so it is a bit rough and ugly, but I think this is getting close to the functionality you want, if I understood correctly.

It starts with the scrolledpanel acting like a normal panel, growing in size, then when it reaches a threshold where it switches to growing with scroll bars, instead of growing within the Frame.

testscrolledpanel.py (2.27 KB)

···

On Tuesday, July 22, 2014 6:48:49 AM UTC-7, Che M wrote:

Hi Werner,

Maybe I’m misunderstanding, but what you attached seems to just show how to use ScrolledPanel in the normal way. That I can do. I just don’t want to use it in the normal way, but in the perhaps unusual way I described in the previous message.

Maybe I will make a sample runnable sample that shows the situation and attach it later…stay tuned…

Che

On Tue, Jul 22, 2014 at 3:57 AM, Werner wern...@gmx.ch wrote:

Hi Che,

  On 7/22/2014 9:09, C M wrote:
        On Tue, Jul 22, 2014 at 2:56 AM, > > > Werner <wern...@gmx.ch> > > >             wrote:

Hi Che,

                On 7/22/2014 6:04, C M wrote:

            Do you have a sizer

to which you add the ScrolledPanel?

Yes, a FlexGridSizer.

Hhm, with the sample sample attached it is not needed as long as it

is the only widget in the frame.

If I have the range set to 2 there are are no scrollbars and if it

is higher the scrollbars show up and if I manually resize the frame
they go away.

What is missing to what you are doing in your code?



Werner

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Thanks, Nathan, but on my system clicking the button is doing nothing other
than printing the sizes...I can't even figure out why it's not adding the
staticText. I am using wxPython == '2.8.12.1 (msw-unicode)'. But I don't
think that should matter. I'm probably staring right at it and don't see
the issue...do you?

Thanks for the help,
Che

···

On Tue, Jul 22, 2014 at 3:38 PM, Nathan McCorkle <nmz787@gmail.com> wrote:

I think I understood what you wanted... give this example a try... I
didn't clean it up so it is a bit rough and ugly, but I think this is
getting close to the functionality you want, if I understood correctly.

It starts with the scrolledpanel acting like a normal panel, growing in
size, then when it reaches a threshold where it switches to growing with
scroll bars, instead of growing within the Frame.

Wait, OK: one issue was that this line had to have the proportion changed
to 1:

self.vbox.Add(self.fa, 1, wx.EXPAND)
                                   ^ was previously 0 here

Now I can see that self.fa panel. But now, clicking just makes more static
texts, but there are never scroll bars nor resizing of the whole frame.

Che

···

On Tue, Jul 22, 2014 at 8:56 PM, C M <cmpython@gmail.com> wrote:

On Tue, Jul 22, 2014 at 3:38 PM, Nathan McCorkle <nmz787@gmail.com> wrote:

I think I understood what you wanted... give this example a try... I
didn't clean it up so it is a bit rough and ugly, but I think this is
getting close to the functionality you want, if I understood correctly.

It starts with the scrolledpanel acting like a normal panel, growing in
size, then when it reaches a threshold where it switches to growing with
scroll bars, instead of growing within the Frame.

Thanks, Nathan, but on my system clicking the button is doing nothing
other than printing the sizes...I can't even figure out why it's not adding
the staticText. I am using wxPython == '2.8.12.1 (msw-unicode)'. But I
don't think that should matter. I'm probably staring right at it and don't
see the issue...do you?

The file I posted was using 2.9.4-msw I think. Clicking the button added staticTexts, I just held down the Enter/Return key on my keyboard and that would add more and more until just before it would add enough staticText to push the button off the screen, then it starts scrolling and subsequent staticTexts are added and the scroll bars start to change. I didn’t cause any events to change the Frame size, but that shouldn’t be too hard if that is what you want.

···

On Tuesday, July 22, 2014 6:16:56 PM UTC-7, Che M wrote:

On Tue, Jul 22, 2014 at 8:56 PM, C M cmpy...@gmail.com wrote:

On Tue, Jul 22, 2014 at 3:38 PM, Nathan McCorkle nmz...@gmail.com wrote:

I think I understood what you wanted… give this example a try… I didn’t clean it up so it is a bit rough and ugly, but I think this is getting close to the functionality you want, if I understood correctly.

It starts with the scrolledpanel acting like a normal panel, growing in size, then when it reaches a threshold where it switches to growing with scroll bars, instead of growing within the Frame.

Thanks, Nathan, but on my system clicking the button is doing nothing other than printing the sizes…I can’t even figure out why it’s not adding the staticText. I am using wxPython == ‘2.8.12.1 (msw-unicode)’. But I don’t think that should matter. I’m probably staring right at it and don’t see the issue…do you?

Wait, OK: one issue was that this line had to have the proportion changed to 1:

self.vbox.Add(self.fa, 1, wx.EXPAND)

 ^ was previously 0 here

Now I can see that self.fa panel. But now, clicking just makes more static texts, but there are never scroll bars nor resizing of the whole frame.

Che

Huh. I tried it on both wx2.8.12-msw and wx2.9.4-msw and it worked only
with 2.9.4. I am rather surprised by that, because I didn't think there
were changes that would affect this basic example--particularly in that the
difference of changing the proportionality value mattered. To review:

This works on 2.9.4-msw:
    self.vbox.Add(self.fa, 0, wx.EXPAND)

but doesn't show anything when run on 2.8.12. This does show it:
    self.vbox.Add(self.fa, 1, wx.EXPAND)

Anyone know what the difference is between the two wx versions that should
cause this?

I'll have to play around with it more to see if I can use it in my case.
Thanks again for doing this.

Che

···

On Wed, Jul 23, 2014 at 2:32 AM, Nathan McCorkle <nmz787@gmail.com> wrote:

The file I posted was using 2.9.4-msw I think. Clicking the button added
staticTexts, I just held down the Enter/Return key on my keyboard and that
would add more and more until just before it would add enough staticText to
push the button off the screen, then it starts scrolling and subsequent
staticTexts are added and the scroll bars start to change. I didn't cause
any events to change the Frame size, but that shouldn't be too hard if that
is what you want.