--- wx_object.original.erl	2009-09-25 23:22:12.810000000 +0200
+++ wx_object.erl	2009-10-09 12:22:13.115710400 +0200
@@ -143,8 +143,7 @@
 %% @doc Starts a generic wx_object server and invokes Mod:init(Args) in the
 %% new process.
 start(Mod, Args, Options) ->
-    {ok, Pid} = gen:start(?MODULE, nolink, Mod, Args, [get(?WXE_IDENTIFIER)|Options]),
-    receive {ack, Pid, Ref = #wx_ref{}} -> Ref end. 
+    gen_response(gen:start(?MODULE, nolink, Mod, Args, [get(?WXE_IDENTIFIER)|Options])).
 	    
 %% @spec (Name, Mod, Args, Options) -> wxWindow:wxWindow() 
 %%   Name = {local, atom()}
@@ -155,8 +154,7 @@
 %% @doc Starts a generic wx_object server and invokes Mod:init(Args) in the
 %% new process.
 start(Name, Mod, Args, Options) ->
-    {ok, Pid} = gen:start(?MODULE, nolink, Name, Mod, Args, [get(?WXE_IDENTIFIER)|Options]),
-    receive {ack, Pid, Ref = #wx_ref{}} -> Ref end. 
+    gen_response(gen:start(?MODULE, nolink, Name, Mod, Args, [get(?WXE_IDENTIFIER)|Options])).
 
 %% @spec (Mod, Args, Options) -> wxWindow:wxWindow() 
 %%   Mod = atom() 
@@ -166,8 +164,7 @@
 %% @doc Starts a generic wx_object server and invokes Mod:init(Args) in the
 %% new process.
 start_link(Mod, Args, Options) ->
-    {ok, Pid} = gen:start(?MODULE, link, Mod, Args, [get(?WXE_IDENTIFIER)|Options]),
-    receive {ack, Pid, Ref = #wx_ref{}} -> Ref end. 
+    gen_response(gen:start(?MODULE, link, Mod, Args, [get(?WXE_IDENTIFIER)|Options])).
 
 %% @spec (Name, Mod, Args, Options) -> wxWindow:wxWindow() 
 %%   Name = {local, atom()}
@@ -177,9 +174,13 @@
 %%   Flag = trace | log | {logfile, File} | statistics | debug
 %% @doc Starts a generic wx_object server and invokes Mod:init(Args) in the
 %% new process.
-start_link(Name, Mod, Args, Options) ->
-    {ok, Pid} = gen:start(?MODULE, link, Name, Mod, Args, [get(?WXE_IDENTIFIER)|Options]),
-    receive {ack, Pid, Ref = #wx_ref{}} -> Ref end. 
+start_link(Name, Mod, Args, Options) ->
+    gen_response(gen:start(?MODULE, link, Name, Mod, Args, [get(?WXE_IDENTIFIER)|Options])).
+    
+gen_response({ok, Pid}) ->
+    receive {ack, Pid, Ref = #wx_ref{}} -> Ref end;
+gen_response(Reply) ->
+    Reply.
 
 %% @spec(wxObject(), Request) -> term()
 %% @doc Make a call to a wx_object server. 
@@ -190,7 +191,18 @@
 	Res
     catch _:Reason ->
 	    erlang:error({Reason, {?MODULE, call, [Ref, Request]}})
-    end.
+    end;
+%% @spec(atom(), Request) -> term()
+%% @doc Make a call to a registered wx_object server
+%% Invokes handle_call(Request, From, State) in server
+call(Name, Request) when is_atom(Name) ->
+    try
+        {ok,Res} = gen:call(Name, '$gen_call', Request),
+        Res
+    catch _:Reason ->
+            erlang:error({Reason, {?MODULE, call, [Name, Request]}})
+    end.
+    
 %% @spec(wxObject(), Request, integer()) -> term()
 %% @doc Make a call to a wx_object server. 
 %% Invokes handle_call(Request, From, State) in server
@@ -200,6 +212,16 @@
 	Res
     catch _:Reason ->
 	    erlang:error({Reason, {?MODULE, call, [Ref, Request, Timeout]}})
+    end;
+%% @spec(atom(), Request, integer()) -> term()
+%% @doc Make a call to a registered wx_object server
+%% Invokes handle_call(Request, From, State) in server
+call(Name, Request, Timeout) when is_atom(Name) ->
+    try
+        {ok,Res} = gen:call(Name, '$gen_call', Request, Timeout),
+        Res
+    catch _:Reason ->
+            erlang:error({Reason, {?MODULE, call, [Name, Request, Timeout]}})
     end.
 	    
 %% -----------------------------------------------------------------
