Erlang wx_ref和自定义wx_对象的

Erlang wx_ref和自定义wx_对象的,erlang,wxwidgets,wxerlang,Erlang,Wxwidgets,Wxerlang,我正在wxErlang的帮助下开发MDI应用程序。我有一个父帧,实现为wx_对象: -module(main_frame). -export([new/0, init/1, handle_call/3, handle_event/2, terminate/2]). -behaviour(wx_object). .... 我有一个子框架,也是作为wx_对象实现的: module(child_frame). -export([new/2, init/1, handle_call/3, hand

我正在wxErlang的帮助下开发MDI应用程序。我有一个父帧,实现为wx_对象:

-module(main_frame).
-export([new/0, init/1, handle_call/3, handle_event/2, terminate/2]).

-behaviour(wx_object).

....
我有一个子框架,也是作为wx_对象实现的:

module(child_frame).
-export([new/2, init/1, handle_call/3, handle_event/2, terminate/2]).
-export([save/1]).

-behaviour(wx_object).

% some public API method
save(Frame) ->
    wx_object:call(Frame, save).

....
我想从父帧调用save/1以获取活动子帧。这是我的代码:

 ActiveChild = wxMDIParentFrame:getActiveChild(Frame),
 case wx:is_null(ActiveChild) of
  false ->
   child_frame:save(ActiveChild);
  _ ->
   ignore
 end

此代码失败,因为ActiveChild是wx_ref{},状态为[],但wx_object:call/2需要wx_ref{},其中状态设置为我们调用的进程的pid。正确的方法是什么?我原以为只在父帧中存储所有创建的子帧及其pid的列表,然后在此列表中搜索pid,但这很难看。

您当前无法从中获取erlang对象/进程 wxMDIParentFrame:getActiveChildFrame

您必须将erlang子对象保持在您的状态,并保持活动子对象, 还可以随时更新事件

这里有改进的余地