| Author |
Message |
< Erlang ~ wxTextCtrl crashes werl.exe not erl.exe |
| Philomath |
Posted: Sun Feb 13, 2011 7:52 am |
|
|
|
Joined: 13 Feb 2011
Posts: 1
|
I am just learning Erlang. I wrote a simple program on my Linux box and decided to test it on a friend's Windows box. I downloaded and installed R14B01, copied my .erl file over, and attempted to run it. Werl crashes to the desktop if all references to wxTextCtrl aren't removed. Erl compiles and runs this fine (with the -smp flag). I figure I must be doing something wrong but I can't for the life of me figure out what. Please forgive any naivete, it's my first bit of code with either Erlang or Wx. Note that "\lib\wx-0.98.8\examples\demo\" has exactly the same problem. Anyway, here's the offending code:
Code:
-module(listings2).
-include_lib("kernel/include/file.hrl").
-include_lib("wx/include/wx.hrl").
-import(lists,[map/2, sort/1]).
-compile(export_all).
-define(NEW,100).
-define(OPEN,101).
-define(SAVE,102).
-define(SAVEAS,103).
-define(EXIT,?wxID_EXIT).
%% Top-level function
start() ->
WX = wx:new(),
Frame = wxFrame:new(wx:null(), ?wxID_ANY, "fileIO"),
Text = wxTextCtrl:new(Frame, ?wxID_ANY, [{value,"fileIO"}, {style, ?wxTE_MULTILINE}]),
setup(WX,Frame,Text),
wxFrame:show(Frame),
loop(Frame,Text,""),
wx:destroy().
%% Build the UI
setup(WX,Frame,Text) ->
MenuBar = wxMenuBar:new(),
File = wxMenu:new(),
wxMenu:append(File,?NEW, "New\tCtrl-N"),
wxMenu:append(File,?OPEN, "Open\tCtrl-O"),
wxMenu:appendSeparator(File),
wxMenu:append(File,?SAVE, "Save\tCtrl-S"),
wxMenu:append(File,?SAVEAS, "Save As\tCtrl-A"),
wxMenu:appendSeparator(File),
wxMenu:append(File,?EXIT, "Quit"),
wxMenuBar:append(MenuBar,File,"&File"),
wxFrame:setMenuBar(Frame,MenuBar),
wxTextCtrl:setEditable(Text,true),
wxFrame:createStatusBar(Frame),
wxFrame:setStatusText(Frame,"file IO test"),
wxFrame:connect(Frame,command_menu_selected),
wxFrame:connect(Frame,close_window).
%% UI message loop
loop(Frame,Text,Fname) ->
receive
#wx{id=?NEW, event=#wxCommand{type=command_menu_selected}} ->
wxTextCtrl:clear(Text),
loop(Frame,Text,"");
#wx{id=?OPEN, event=#wxCommand{type=command_menu_selected}} ->
FD = wxFileDialog:new(Frame, [{message, "Select file to open"}]),
wxDialog:showModal(FD),
S = wxFileDialog:getFilename(FD),
wxTextCtrl:loadFile(Text,S),
loop(Frame,Text,S);
#wx{id=?SAVE, event=#wxCommand{type=command_menu_selected}} ->
if
(is_list(Fname) andalso length(Fname) < 1) ->
FD = wxFileDialog:new(Frame, [{message, "Select filenamd to save as"}]),
wxDialog:showModal(FD),
S = wxFileDialog:getFilename(FD),
io:format("Save As Filename: ~p~n",[S]),
wxTextCtrl:saveFile(Text,[{file,S}]),
loop(Frame,Text,S);
(is_list(Fname) andalso length(Fname) > 0) ->
wxTextCtrl:saveFile(Text,[{file,Fname}]),
loop(Frame,Text,Fname)
end;
#wx{id=?SAVEAS, event=#wxCommand{type=command_menu_selected}} ->
FD = wxFileDialog:new(Frame, [{message, "Select filename to save as"}]),
wxDialog:showModal(FD),
S = wxFileDialog:getFilename(FD),
wxTextCtrl:saveFile(Text,[{file,S}]),
loop(Frame,Text,S);
#wx{id=?EXIT, event=#wxCommand{type=command_menu_selected}} ->
wxWindow:close(Frame,[]),
wxWindow:destroy(Frame)
end.
|
|
|
| Back to top |
|
| wuji |
Posted: Thu Aug 23, 2012 7:17 am |
|
|
|
User
Joined: 10 Aug 2012
Posts: 654
|
in the meat.In addition to the Minneapolis flight, a needle needle [h2]replica designer *beep*[/h2] needle was discovered by a teenage passenger aboard a Delta
from Amsterdam to Atlanta. The teen would not surrender the the cheap Ralph Lauren the needle to authorities, who noted he told them that
planned to use it as evidence in a lawsuit.In a a [h4]cheap replica *beep*[/h4] a federal report on the incidents, it was noted that
teen was the son of a passenger aboard the flight flight [h4]replica Christian Louboutin[/h4] flight to Minneapolis who also found a needle in his
needles were reported found on two other flights, one by by Cheap Ralph Lauren Shirts by a crew member and another by a federal air |
|
|
| Back to top |
|
| dongdongwu |
Posted: Thu Sep 20, 2012 2:16 am |
|
|
|
User
Joined: 19 Sep 2012
Posts: 236
|
His good friend Diane said: "Christian Louboutin Men Shoes was a magician, he make shoes is immediately put his female people with legs and advantage. He understands women wanted to do and can make them into beautiful Cinderella." Madonna often in its concert wearing Christian louboutin high heels , and some famous superstar like Angelina jolie, mariah Carey, beyonce Knowles, the famous Japanese singer YaYouMei Hamasaki helps Christian Louboutin Men Shoes set up its powerful position. The youngest customers will count Tom cruise's daughter sully cruz. Louboutin made for only a pair of handmade Christian Louboutin high heel Shoes! Want to be more fashion? Put on Christian Louboutin Outlet !
Candy colors of the chalaza high-heeled shoes with lolita type allure, set full finely gem blue "neon shoes" is to need to use "sexy" to describe. Each pair are worth careful appreciation of lithe and graceful fairy ludaoli, what kind of most let you move?Christian Louboutin Men Shoes that one brush red is always cannot resist the temptation, Christian Louboutin men outlet continue to use the days of high 8cm above slender heel proclaim the sexy and luxuriant. The bowknot on black pointed high-heeled shoes with sharp rivet concomitant, wild python met enchanting color printing grain, It is that pairs of high-heeled shoes lets Carrie more feminine flavour. Like Christian Louboutin for men her word. |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|