how to make wx.ScrolledWindow.SetTargetWindow work?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to make wx.ScrolledWindow.SetTargetWindow work?

m.reg380
hi,

i am designing a spreadsheet,i will normally only have to scroll the cell area, whereas the col header area will scroll only HORIZONTAL.i derive my own class from wx.ScrolledWindow,and call SetTargetWindow,but it did not work,who can tell me why? tks!

python 3.6.3 wxpython 4.0.0b2 win 10 64bit



--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

grideditor.py (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to make wx.ScrolledWindow.SetTargetWindow work?

Tim Roberts

i am designing a spreadsheet,i will normally only have to scroll the cell area, whereas the col header area will scroll only HORIZONTAL.i derive my own class from wx.ScrolledWindow,and call SetTargetWindow,but it did not work,who can tell me why? tks!


I guess you are going to have to tell us what it was that didn't work as you expected, because when I run your code  the scrolling seems to work just as you describe.
-- 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: how to make wx.ScrolledWindow.SetTargetWindow work?

m.reg380
when i run this code,the horizontal scrollbar did not show,but i want to show it,there are 15 cols but i can only see 5.  and the vertical scrollbar did not work well ,because there are 50 rows but it just shows 14.
tks



在 2017年12月5日星期二 UTC+8上午1:11:40,Tim Roberts写道:
<a href="javascript:" target="_blank" gdf-obfuscated-mailto="HtM2xCdMBwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">m.re...@... wrote:

i am designing a spreadsheet,i will normally only have to scroll the cell area, whereas the col header area will scroll only HORIZONTAL.i derive my own class from wx.ScrolledWindow,and call SetTargetWindow,but it did not work,who can tell me why? tks!


I guess you are going to have to tell us what it was that didn't work as you expected, because when I run your code  the scrolling seems to work just as you describe.
-- 
Tim Roberts, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="HtM2xCdMBwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ti...@...
Providenza & Boekelheide, Inc.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

img01.png (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to make wx.ScrolledWindow.SetTargetWindow work?

Tim Roberts
when i run this code,the horizontal scrollbar did not show,but i want to show it,there are 15 cols but i can only see 5.  and the vertical scrollbar did not work well ,because there are 50 rows but it just shows 14.

Part of the problem is that GridBody should not derive from wx.ScrolledWindow.  It should just derive from wx.Panel.  The parent EditGrid is the ScrolledWindow, and it's going to control the positioning of the GridBody.  Part of the problem is your SetScrollbars command; if you set the scroll size larger (like (20, 20, 150, 150)), you'll see scrollbars.

However, even with all of that, then the header panel doesn't scroll.  I thought you might have better with ScrolledPanel from wx.lib.scrolledpanel; it allows you to freeze scrolling in one direction, but even then, there's no linkage between multiple panels.

I'm afraid you're going to have to implement the scrollbars and scrollbar handling yourself.  So, your main panel would contain the header panel, the body panel, and the scrollbar.  Then, you can adjust the positioning of the child windows yourself.  Tedious, but it should do what you want.
-- 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.