I'm trying to get split windows working using WxErlang in Elixir.
I'm basically doing the exact same thing as the splitterWindow example from :wx.demo, but the :wxSplitterWindow.splitVertically function is returning false (not working) and I don't know wny.
Here's the code:
defmodule SplitWindow do
import Bitwise
import :wx_const # A custom Erlang module that imports wx constants
def start do
wx = :wx.new
window = :wxFrame.new(wx, wxID_ANY, 'SplitWindow')
:wxFrame.center(window)
panel = :wxPanel.new(window)
sizer = :wxBoxSizer.new(wxVERTICAL)
splitter = :wxSplitterWindow.new(panel)
text_edit = :wxTextCtrl.new(panel, wxID_ANY, value: 'Text Box',
style: wxDEFAULT ||| wxTE_MULTILINE)
text_edit2 = :wxTextCtrl.new(panel, wxID_ANY, value: 'Text Box2',
style: wxDEFAULT ||| wxTE_MULTILINE)
##### This line below is where it fails #####
IO.puts :wxSplitterWindow.splitVertically(splitter, text_edit, text_edit2)
:wxSplitterWindow.setSashGravity(splitter, 0.5)
:wxSplitterWindow.setMinimumPaneSize(splitter, 50)
:wxSizer.add(sizer, splitter, flag: wxEXPAND, proportion: 1)
:wxPanel.setSizer(panel, sizer)
:wxFrame.show(window)
end
end
The IO.puts will output: false
I'm not getting any other errors.
Here is a screenshot of the program running: http://screencast.com/t/g0sG89ECi
Anyone have any ideas of what I'm doing wrong here?
Thanks.
Don't know anything about wxWidgets, but tried your example locally (OS X) and it was breaking for me as well.
Looking at the code, on a hunch I tried setting the parent for both edit controls to be the splitter, rather than the panel, and that fixed it for me: