wxScrolledPanel scrolling on OnFocus problem

Hi.

I've got a program I'd like to see added to the wxPython examples. It's
actually pretty similar to PySketch, but it has a number of nice features
which set it apart.

However, before we can do that, I've got a problem that's been driving me
nuts. It can be seen quite clearly in the demos for wxPython 2.4.2.4 by doing
the following:
python wxScrolledPanel.py
# click on another window, removing focus from the demo.
# Now click on the demo window. The wxScrolledPanel will scroll down and
right, which it definitely should not do.

I'm using Debian right now, but I believe that the same problem exists for
2.5.1.5 on Windows.

Does anyone know of a workaround?

Thanks,
        Josh
- --
http://www.uvm.edu/~jgilbert/public_key.gpg

Josh Gilbert wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

I've got a program I'd like to see added to the wxPython examples. It's
actually pretty similar to PySketch, but it has a number of nice features
which set it apart.

However, before we can do that, I've got a problem that's been driving me
nuts. It can be seen quite clearly in the demos for wxPython 2.4.2.4 by doing
the following:
python wxScrolledPanel.py
# click on another window, removing focus from the demo.
# Now click on the demo window. The wxScrolledPanel will scroll down and
right, which it definitely should not do.

I'm using Debian right now, but I believe that the same problem exists for
2.5.1.5 on Windows.

Does anyone know of a workaround?

It's probably in the code that is ensuring that an item is visible, and it is overcompensating. I'll take a look...

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Josh Gilbert wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

I've got a program I'd like to see added to the wxPython examples. It's
actually pretty similar to PySketch, but it has a number of nice features
which set it apart.

However, before we can do that, I've got a problem that's been driving me
nuts. It can be seen quite clearly in the demos for wxPython 2.4.2.4 by doing
the following:
python wxScrolledPanel.py
# click on another window, removing focus from the demo.
# Now click on the demo window. The wxScrolledPanel will scroll down and
right, which it definitely should not do.

I'm using Debian right now, but I believe that the same problem exists for
2.5.1.5 on Windows.

Does anyone know of a workaround?

It's probably in the code that is ensuring that an item is visible, and it is overcompensating. I'll take a look...

The CVS version of the demo needed a little tweaking to fix a layout issue, but the only extra scrolling I saw in 2.5.1.5 and 2.4.2.4 is just what it does to ensure that the whole child is visible when it gets the focus. After the initial shift I couldn't get it to shift again when changing apps and clicking back on the demo unless I selected another control or subpanel that was only partially visible. I think that it is acting correctly in these cases.

There is one case where it is not acting correctly and that is when a control is too big to entirely display in the client area of the scrolled panel. It is currently scrolling to make the bottom/right visible, I think I will change it so that it will only scroll enough to make the top.left visible.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hello,

I am still trying to find my way around event handling in wxPython. So
far I got great responses to all my questions, thanks a lot.

So, I got another question.

I have non GUI class, and I want to use the generic publish subscribe
model in wxPython. I created a custom event as follows:

(UpdateStatusEvent, EVT_SERVER_STATUS) = wx.lib.newevent.NewEvent()

Now, I want to send this event in the non GUI class. Looking at the
wx.PostEvent() it looks like that I have to supply a window as the event
handler, but I don't have access to such a window.

How should this be done in a non GUI class?

Thanks again,
-H

Ok, I kept looking around, and found out that I can have access to the
wx.App instance via the wx.GetApp(), so is it an okay practice to do
this within the non GUI class (to post and event)?:

Class nonGUI:
  def TellEveryBodyThanks():
    eventt = UpdateStatusEvent(greatGuys="cool")
    wx.PostEvent(wx.GetApp(), eventt)

-H

···

-----Original Message-----
From: Hatim Khan [mailto:hkhan@mcfadyen.com]
Sent: Friday, May 28, 2004 2:25 PM
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] Posting an event without a window

Hello,

I am still trying to find my way around event handling in wxPython. So
far I got great responses to all my questions, thanks a lot.

So, I got another question.

I have non GUI class, and I want to use the generic publish subscribe
model in wxPython. I created a custom event as follows:

(UpdateStatusEvent, EVT_SERVER_STATUS) = wx.lib.newevent.NewEvent()

Now, I want to send this event in the non GUI class. Looking at the
wx.PostEvent() it looks like that I have to supply a window as the event
handler, but I don't have access to such a window.

How should this be done in a non GUI class?

Thanks again,
-H

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hatim Khan wrote:

Ok, I kept looking around, and found out that I can have access to the
wx.App instance via the wx.GetApp(), so is it an okay practice to do
this within the non GUI class (to post and event)?:

Class nonGUI:
  def TellEveryBodyThanks():
    eventt = UpdateStatusEvent(greatGuys="cool")
    wx.PostEvent(wx.GetApp(), eventt)

Yes it's okay, but keep in mind that the event handler that receives the event will have to be bound to the App object. If you need to receive the messages elsewhere then perhaps you will want to use something like dispatcher (found in wx.py.dispatcher) or pubsub (wx.lib.pubsub).

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!