4
%% Copyright Ericsson AB 2009. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
19
%%%-------------------------------------------------------------------
21
%%% Author : Matthew Harrison <harryhuk at users.sourceforge.net>
22
%%% Description : _really_ minimal example of a wxerlang app
24
%%% Created : 18 Sep 2008 by Matthew Harrison <harryhuk at users.sourceforge.net>
25
%%%-------------------------------------------------------------------
28
-include_lib("wx/include/wx.hrl").
35
Frame = wx:batch(fun() -> create_window(Wx) end),
42
Frame = wxFrame:new(Wx,
44
"Hello World", % window title
48
wxFrame:createStatusBar(Frame,[]),
50
%% if we don't handle this ourselves, wxwidgets will close the window
51
%% when the user clicks the frame's close button, but the event loop still runs
52
wxFrame:connect(Frame, close_window),
54
ok = wxFrame:setStatusText(Frame, "Hello World!",[]),
59
#wx{event=#wxClose{}} ->
60
io:format("~p Closing window ~n",[self()]),
61
ok = wxFrame:setStatusText(Frame, "Closing...",[]),
62
wxWindow:destroy(Frame),
65
io:format("Got ~p ~n", [Msg]),