[erlang-questions] Multiple wx-erlang processes
Dan Gudmundsson
dgud@REDACTED
Mon May 16 09:26:47 CEST 2011
Yes that is how how handle set/get_env.
But why not create the panel and setup the event subscription inside
init as well,
the thought here was that wx_object is used to override the C++ object and
thus you return {Panel, State} from init.
/Dan
On Sun, May 15, 2011 at 9:32 PM, Bob Cowdery <bob@REDACTED> wrote:
> Hi,
>
> This seems to initialise ok but is it the correct way to do things
> before I start implementing the main functions.
>
> I have a main wx processing using wx_object behaviour. This handles all
> the user interaction stuff. Now I want a separate process that will
> handle graphic displays. I create another wx_object process and start it
> from the main wx process
>
> The start/2 and init/2 of the graphic display.
>
> start(Env, Frame) ->
> wx_object:start_link({local, ?MODULE}, ?MODULE, [Env, Frame], []),
> {ok, self()}.
>
> init([Env, Frame]) ->
> io:format("~p starting~n", [?MODULE]),
> wx:set_env(Env),
> {Frame, #state{}}.
>
> I pass in wx:get_env() and the main frame of the main wx process as I
> don't want another frame.
>
> Then call from the main process (which is using AUI) to set up the
> drawing surface.
>
> handle_cast({create_display, Parent, Manager, Pane}, State) ->
> %% Canvas on which to build graphics
> Canvas = wxPanel:new(Parent, [{style, ?wxFULL_REPAINT_ON_RESIZE}]),
> ...
>
> Regards
> Bob
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list