anchor.diff:  	    continue
       end.
   
  -addArgs(_Parent, _Sizer, Max, Max, Refs) ->
  -    lists:reverse(Refs);
  -addArgs(Parent, Sizer, I, Max, Refs) ->
  -    Ref =  wxTextCtrl:new(Parent, ?wxID_ANY),
  -    HorizSizer = wxBoxSizer:new(?wxHORIZONTAL),
  -    wxSizer:add(HorizSizer,
  -		wxStaticText:new(Parent, ?wxID_ANY, io_lib:format("Arg~p: ", [I + 1])),
  -		[{proportion, 0},
  -		 {flag, ?wxALL bor ?wxALIGN_CENTER}, {border, 10}]),
  -    wxSizer:add(HorizSizer,
  -		Ref,
  -		[{proportion, 1}, {flag, ?wxALL bor ?wxALIGN_CENTER}, {border, 10}]),
  -    wxSizer:add(Sizer,
  -		HorizSizer,
  -		[{proportion, 0}, {flag, ?wxALL bor ?wxEXPAND}, {border, 10}]),
  -    addArgs(Parent, Sizer, I + 1, Max, [Ref|Refs]).
  +getFunction() ->
  +    FunctionList = refServer:lookup(?FUNCTION_LIST),
  +    Expr = wxControlWithItems:getStringSelection(FunctionList),
  +    Match = re:run(Expr, "(?<FUN>.*)/(?<ARITY>.*)\$",
  +                   [dotall, {capture, ['FUN', 'ARITY'], list}]),
  +    case Match of
  +	{match, [Fun, Arity]} ->
  +	    {list_to_atom(Fun), list_to_integer(Arity)};
  +	nomatch -> {'', 0}
  +    end.
  +
  +getModule() ->
  +    ModuleList = refServer:lookup(?MODULE_LIST),
  +    Path = wxControlWithItems:getStringSelection(ModuleList),
  +    Match =  re:run(Path, ".*/(?<MODULE>.*?)\.erl\$",
  +                    [dotall, {capture, ['MODULE'], list}]),
  +    case Match of
  +	{match, [Module]} -> list_to_atom(Module);
  +	nomatch -> ''
  +    end.
  +
  +%% wxControlWithItems:getStrings (function missing from wxErlang lib)
  +getStrings(Ref) ->
  +    Count = wxControlWithItems:getCount(Ref),
  +    if
  +	Count > 0 ->
  +	    getStrings(Ref, 0, Count, []);
  +	true ->
  +	    []
  +    end.
  +
  +getStrings(_Ref, Count, Count, Strings) ->
  +    Strings;
  +getStrings(Ref, N, Count, Strings) ->
  +    String = wxControlWithItems:getString(Ref, N),
  +    getStrings(Ref, N + 1, Count, [String|Strings]).
  +
  +%% Instrument all modules in ModuleList
  +instrumentAll(Id) ->
  +    ModuleList = refServer:lookup(Id),
  +    instrumentList(getStrings(ModuleList)).
  +
  +instrumentList([]) ->
  +    ok;
  +instrumentList([String|Strings]) ->
  +    instrument:c(String),
  +    instrumentList(Strings).
  +
  +%% Set ListBox (Id) items (remove existing)
  +setListItems(Id, Items) ->
  +    if
  +	Items =/= [], Items =/= [[]] ->
  +	    List = refServer:lookup(Id),
  +	    wxListBox:set(List, Items),
  +	    wxControlWithItems:setSelection(List, 0),
  +	    %% XXX: hack (send event message to self)
  +	    self() ! #wx{id = Id,
  +                         event = #wxCommand{type = command_listbox_selected}};
  +	true ->
  +	    continue
  +    end.
   
   validateArgs(_I, [], Args, _RefError) ->
       {ok, lists:reverse(Args)};
  
positive.code: 	    Frame = refServer:lookup(?FRAME),
  	    addDialog(Frame),
  	    loop();
  	%% -------------------- Catchall -------------------- %%
  	Other ->
  	    io:format("loop unimplemented: ~p~n", [Other]),
  	    loop()
      end.
  
negative.code:     [SetStyles(Style) || Style <- Styles],
      wxStyledTextCtrl:setKeyWords(Ref, 0, ?KEYWORDS).
  
  %%%----------------------------------------------------------------------
  %%% Helper functions
  %%%----------------------------------------------------------------------
  
  addArgs(_Parent, _Sizer, Max, Max, Refs) ->
      lists:reverse(Refs);
  addArgs(Parent, Sizer, I, Max, Refs) ->
      Ref =  wxTextCtrl:new(Parent, ?wxID_ANY),
      HorizSizer = wxBoxSizer:new(?wxHORIZONTAL),
      wxSizer:add(HorizSizer,
  		wxStaticText:new(Parent, ?wxID_ANY, io_lib:format("Arg~p: ", [I + 1])),
  		[{proportion, 0},
  		 {flag, ?wxALL bor ?wxALIGN_CENTER}, {border, 10}]),
      wxSizer:add(HorizSizer,
  		Ref,
  		[{proportion, 1}, {flag, ?wxALL bor ?wxALIGN_CENTER}, {border, 10}]),
      wxSizer:add(Sizer,
  		HorizSizer,
  		[{proportion, 0}, {flag, ?wxALL bor ?wxEXPAND}, {border, 10}]),
      addArgs(Parent, Sizer, I + 1, Max, [Ref|Refs]).
  
  %% Module-adding dialog
  addDialog(Parent) ->
      Caption = "Open erlang module",
  