>This next wxPanel is on top of the CHART window. I would suggest >drawing the image on a wxPanel yourself since the wxStaticBitmap is >really meant for small images. You can either let the scrolled window >take care of moving the image or get the coords from the scrolled >window and crop the image before drawing. > >Hope this helps, > John
Thanks, it appears to work perfectly. :) It's a lot simpler than it was. I still have a few questions though... First, the code, in FULL because the one thing that made my day most difficult is snippets out of context. So much easier if a copy/paste of a working example can be had, then debugging is simple, focus on what change breaks something. For small examples I see no better way than this.. function main() FRAME=wx.wxFrame(wx.NULL,-1,"GPS Plot",wx.wxDefaultPosition,wx.wxSize(1024,768),wx.wxDEFAULT_FRAME_STYLE) FRAME:Centre() FRAME:Show(true) FRAME:CreateStatusBar() BITMAP=wx.wxBitmap("../Charts/Ashton Court.gif",wx.wxBITMAP_TYPE_GIF) local X,Y=BITMAP:GetWidth(),BITMAP:GetHeight() SCROLL=wx.wxScrolledWindow(FRAME,-1) SCROLL:SetScrollbars(1,1,X,Y) CHART=wx.wxPanel(SCROLL,-1,wx.wxPoint(0,0),wx.wxSize(X,Y)) CHART:Connect(wx.wxEVT_LEFT_DOWN,OnLeftDown) CHART:Connect(wx.wxEVT_MOTION,OnMotion) CHART:Connect(wx.wxEVT_PAINT,OnPaint) end --==================== Mouse Handling ====================-- MX,MY,VX,VY=0,0,0,0 function OnLeftDown(event) MX,MY,VX,VY=wx.wxGetMousePosition():GetX(),wx.wxGetMousePosition():GetY(),SCROLL:GetViewStart() end function OnMotion(event) if event:LeftIsDown() then SCROLL:Scroll(VX+MX-wx.wxGetMousePosition():GetX(),VY+MY-wx.wxGetMousePosition():GetY()) end end --==================== Track Drawing =====================-- function OnPaint(event) local DC=wx.wxPaintDC(CHART) DC:DrawBitmap(BITMAP,0,0,false) DC:SetPen(wx.wxPen(wx.wxColour(255,0,0),1,wx.wxSOLID)) DC:DrawLine(0,0,600,600) DC:delete() end --==========================================================-- main() The questions: Why does it need s status bar? It still borks and displays nothing without that being there, and I still can't see why.. Is there a way to make the BITMAP draw once and still work, so I can delete it once it's drawn to the DC for the CHART panel? Is this even in line with the advice on deleting large bitmaps to save resources in MSW? Is it wise to expand the OnPaint() function to assign the wxPen and wxColour to variables on creation so I can delete them individually? I'm not clear as to whether they are orphaned and consuming resources after the DC:delete(). I do suspect that something persists, as after a few tens of loads in a session, the script was failing to draw the chart, only the line. And, why DC:delete() not DC:Delete() like XYZ:Refresh() or ABC:Show()...? :) Small case-sensitive gotchas like this are one thing that really makes it tough to debug stuff for newcomers. If the code is now correct, I want to focus on scaling, so should I do this by converting the loaded bitmap to a wxImage() or would it be faster just to load prescaled bitmaps? If the former, can you give me a minimal template for building the needed conversions into the current code? I can convert to image but I'm not clear at what point the image should be deleted after reconversion to bitmap, or even how to reconvert it. You mentioned cropping. This sounds good if it allows a speed gain by avoiding having to draw the whole of a large image. Will it do that though? I imagine that the dragging of the image will cause this image crop and display to occur with every pixel-shift of motion, and not be fast at all. ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users