[erlang-questions] Background wx_object set_id/2

Dan Gudmundsson dangud@REDACTED
Mon Aug 6 15:27:45 CEST 2018


On Mon, Aug 6, 2018 at 2:56 PM Frans Schneider <fchschneider@REDACTED>
wrote:

> I am not really sure I get the full picture yet. So, it is not tinkering
> with the wx_object process itself but just sets an attribute in the data
> structure of the wxWidget object?


Yes


> But why are the wx_object functions
> stop, call and cast using that Pid than?
>

I don't think I understand the question, stop, call and cast needs to know
which pid to send the messages to.

Normally the pid attribute is set in wx_object init before it is returned
to the user.

But if you get the wxWidget object via another call to wx the pid attribute
may not be set, and this gave an option to associate the pid with the
wxWidgets object without tinkering with internal opaque record.

I needed to set it somewhere/sometime and added the function so I could
keep the record definition internal to wx.

/Dan


>
> Frans
>
> On 08/06/2018 02:29 PM, Dan Gudmundsson wrote:
> > If you use wx_object module the pid is used to access the corresponding
> > erlang process/server.
> >
> > If you fetch the "object" from wxWidgets for example
> > from Parent = wxWindow:getParent(Window) you will get an object without
> > the pid set and you can manually set it with wx_object:set_pid/2.
> >
> > /Dan
> >
> > On Mon, Aug 6, 2018 at 1:42 PM Frans Schneider <fchschneider@REDACTED
> > <mailto:fchschneider@REDACTED>> wrote:
> >
> >     Dear list,
> >
> >     I am wondering what purpose the wx_object:set_pid/2 function serves?
> >     Why
> >     would one use this?
> >
> >     Thanks,
> >
> >     Frans
> >     _______________________________________________
> >     erlang-questions mailing list
> >     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
> >     http://erlang.org/mailman/listinfo/erlang-questions
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180806/b84c91bc/attachment.htm>


More information about the erlang-questions mailing list