anchor.diff:  
   create_window() ->
   	%% Create the window.
  -	Window = wxFrame:new(wx:null(), -1, "erledit", [{size, {800, 600}}]),
  +	Window = wxFrame:new(wx:null(), ?wxID_ANY, "erledit", [{size, {800, 600}}, {style, ?wxDEFAULT_FRAME_STYLE}]),
   	StatusBar = wxFrame:createStatusBar(Window),
  -	ok = wxStatusBar:setStatusText(StatusBar, ""),
  +	TextPanel = wxPanel:new(Window, [{style, ?wxVSCROLL bor ?wxHSCROLL}]),
  +	TextCursor = wxCursor:new(?wxCURSOR_IBEAM),
  +	wxFrame:setCursor(TextPanel, TextCursor),
   
   	%% Subscribe to events.
   	wxFrame:connect(Window, close_window, [{callback, fun handle_wx_event/2}]),
  -	wxFrame:connect(Window, char, [{callback, fun handle_wx_event/2}]),
  -	wxFrame:connect(Window, key_down, [{callback, fun handle_wx_event/2}]),
  -	wxFrame:connect(Window, key_up, [{callback, fun handle_wx_event/2}]),
  -	wxFrame:connect(Window, paint
  +	wxFrame:connect(TextPanel, char, [{callback, fun handle_wx_event/2}]),
  +	wxFrame:connect(TextPanel, key_down, [{callback, fun handle_wx_event/2}]),
  +	wxFrame:connect(TextPanel, key_up, [{callback, fun handle_wx_event/2}]),
  +	wxFrame:connect(TextPanel, paint
   		, [{callback, fun handle_paint/2}]
   		),
   
   	%% Show window.
  +	ok = wxStatusBar:setStatusText(StatusBar, ""),
   	wxFrame:show(Window),
   	wxFrame:maximize(Window),
  -	#main_window{window = Window, status_bar = StatusBar}.
  +	#main_window{window = Window, text_panel = TextPanel, text_cursor = TextCursor, status_bar = StatusBar}.
  +
  +destroy_window(#main_window{window = Window, text_panel = TextPanel, text_cursor = TextCursor, status_bar = StatusBar}) ->
  +	wxCursor:destroy(TextCursor),
  +	wxPanel:destroy(TextPanel),
  +	wxStatusBar:destroy(StatusBar),
  +	wxFrame:destroy(Window),
  +	ok.
   
   handle_wx_event(WxMessage, WxEvent) ->
   	case gen_server:call(?MODULE, WxMessage) of
  
positive.code: 	#blink_caret{state = BlinkCaretState} = BlinkCaret,
  	%% TODO: Encapsulate doc view in doc set API.
  	{reply, {Buffer, Caret, BlinkCaretState}, State};
  handle_call(#wx{event = #wxClose{}}, _From, #state{win = #main_window{window = Window}} = State) ->
  	wxWindow:destroy(Window),
  	init:stop(),
  	{reply, ok, State};
  handle_call(#wx{event = #wxKey{} = KeyEvent}, _From, #state{blink_caret = BlinkCaret0} = State0) ->
  
negative.code: -include("ee_doc_set.hrl").
  -include("ee_pubsub.hrl").
  
  -record(main_window, {window, text_panel, text_cursor, status_bar}).
  -record(blink_caret, {state = on, timer}).
  -record(state, {win = #main_window{}, doc_set = #ee_doc_set{}, blink_caret = #blink_caret{}}).
  
  