wxScrolledWindow problems

BlitzMax Forums/Brucey's Modules/wxScrolledWindow problems

spacerat(Posted 2009) [#1]
I am having a few problems with wxScrolledWindow. The first problem is demonstrated reasonably well by this example code:

Framework wx.wxApp
Import wx.wxFrame
Import wx.wxscrolledwindow
Import wx.wxsplitterwindow

New MyApp.Run()

Type MyApp Extends wxApp
	Method OnInit:Int()

		New MyFrame.Create()
		
		Return True
	End Method
End Type

Type MyFrame Extends wxFrame
	
	Method OnInit()
		Local sp:wxSplitterWindow = New wxSplitterWindow.Create(self, -1, 0, 0,,, wxSP_LIVE_UPDATE | wxSP_3D)
		
		Local w1:MyWindow = MyWindow(New MyWindow.Create(sp))
		Local w2:MyWindow = MyWindow(New MyWindow.Create(sp))
		
		sp.SplitVertically(w1, w2)
				
		Show()
		
	End Method

End Type

Type MyWindow Extends wxScrolledWindow
	
	Method OnInit()
		Local p:wxPanel = New wxPanel.Create(self,, 0, 0, 1000, 1000)
		p.SetBackgroundColour(New wxColour.Create(255, 0, 0))
		SetScrollBars(10, 10, 100, 100)
	End Method

End Type


Try moving a scroll bar a bit in one window, clicking in the other, then clicking back in the first. Upon getting focus it scrolls to the bottom right of the window. Being very new to wxWidgets I have no idea why this is happening but there's probably a very simple explanation. My project layout is similar to that test code but I use a wxGLCanvas instead of a panel.

That brings me to my next problem, which I will get round to creating an example of in a bit: the canvas inside a wxScrolledWindows flickers when I scroll. Could this solve my problem?

I also found this which looks useful, but I can't decipher it into something I can actually code.

Anyway, I would greatly appreciate it if someone could help me here with these problems, especially the first which is annoying me the most at the moment.


Brucey(Posted 2009) [#2]
On XP using the 2.9 (SVN) version of wxMax, I cannot replicate the scrolling issue.
It may well be a bug in the 2.8.x branch of wxWidgets which the current wxMax release is built from.

Here's the exe : scroll_test.rar (1.2meg)


spacerat(Posted 2009) [#3]
Thanks Brucey, updating to 2.9 has fixed the scrolling to the bottom right problem. The flickering is less important right now and I have a feeling I might be able to crack the problem myself, but if I don't I'll post some example code or my project.