views:

53

answers:

2

Im having some trouble with the erlang wx module.

My program runs as follows:

Server = wx:new(),
Frame = wxFrame:new(Server, -1, "" [{size,{700, 600}}]),  %%%REFERENCE TO WINDOW
Panel  = wxPanel:new(Frame),  %%% REF TO PANEL IN FRAME

Then I pass Panel to another process and try to create a Grid

XreportZ  = wxGrid:new(Panel, 24, [ {pos, {0,0}} , {style, 1}] ),

The problem occurs when I pass panel, erlang says that the object Panel becomes invalid outside of its local process. So how is it that I can reference Panel outside of the function that spawned it. I do not believe register can be used for this. I belive the answer lies somewhere is referencing the Server and getting back the Panel ID.

To date I still can find no answer.

+1  A: 

Did You try "wx:get_env/0"?

I am not too deep inside wxErlang/wxWidgets, but maybe this could be a start...

bsmr
Although this is correct it is only half the truth. Use get env send the token to the other process and have it set env. That should work. :)
Mazen Harake
Sounds like the end of the functional approaches in Erlang :o)
Zed
A: 

There is such little info out there. What I really want to do is create a window with a list box or grid box, and then update it with info as it comes in.

Problem is right after I am done creating it and finishing its creation process. The handler or whatever the wx equivalent is can't be used. There has to be some way to register it or ask the wx server for it.

I am trying to figure out if the get_env works. It seems to return the id for the wx server, but I have no idea how to ask it for the name of the list box!

Thanks for your help man.