Hi John,

It still crashes right on AddRefDocument:

require "wx"
local frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "STC Demo",
  wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE )
local e1 = wxstc.wxStyledTextCtrl(frame, wx.wxID_ANY,
  wx.wxDefaultPosition, wx.wxSize(0, 0), wx.wxBORDER_STATIC)
local e2 = wxstc.wxStyledTextCtrl(frame, wx.wxID_ANY,
  wx.wxDefaultPosition, wx.wxSize(0, 0), wx.wxBORDER_STATIC)
local sizer = wx.wxBoxSizer(wx.wxVERTICAL)
sizer:Add(e1, 1, wx.wxEXPAND + wx.wxALL, 10)
sizer:Add(e2, 1, wx.wxEXPAND + wx.wxALL, 10)
frame:SetAutoLayout(true)
frame:SetSizer(sizer)

local docpointer = e1:GetDocPointer()
e2:AddRefDocument(docpointer) --<-- crashes here

frame:Show(true)
wx.wxGetApp():MainLoop()

What am I doing wrong? I just need a simple example that shows two STC
windows with the same document. Thank you.

Paul.

On Tue, Jan 22, 2013 at 8:18 PM, John Labenski <jlaben...@gmail.com> wrote:
> On Sun, Jan 20, 2013 at 1:27 AM, Paul K <paulclin...@yahoo.com> wrote:
>> Hi All,
>>
>> Does anyone have an example of how multiple views can be used in
>> wxlua? I looked at the documentation here
>> http://www.yellowbrain.com/stc/mult_views.html, but even a simple code
>> like this crashes the app:
>>
>> local pointer = ed:GetDocPointer()
>> ed:ReleasePointer(pointer)
>
> You need to increase the ref count of the doc pointer.
>
> AddRefDocument(origEditor->GetDocPointer());
> SetDocPointer(origEditor->GetDocPointer());
>
> and then release it before the refed editor is destroyed.
>
> ReleaseDocument(GetDocPointer());
>
> Hope this helps,
>     John
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> _______________________________________________
> wxlua-users mailing list
> wxlua-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxlua-users

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to