wxNotebook and wx_object

Mazen Harake mazen.harake@REDACTED
Sun Sep 27 11:41:34 CEST 2009


Hi,

Before I post a patch to erlang-patches I was just wondering if it these 
two things are intended behaviour:

1) If I add  a Panel to Notebook (as a page) and then destroy the Panel, 
I can then ask for the panel on the same index (wxNotebook:getPage/2) 
and get a different panel. further more, if I have added a panel and 
then ask for an index outside of the number of panels I get a new Panel 
which I never created. Also, why does the page index start at 0 when 
everything else in Erlang is 1 based (pretty much).

E.g:
Nb = wxNotebook:new(Parent, ?wxID_ANY, []),
Panel = wxPanel:new(),
wxNotebook:addPage(Nb, Panel, "Whatever", []), %% this is the first page 
added
P1 = wxNotebook:getPage(Nb, 0), %% this gives the first page added (Panel),
PUnknown = wxNotebook:getPage(Nb, 1), %% this gives a new page... why? 
shouldn't it crash or something?
wxPanel:destroy(Panel), %% delete the panel
P2 = wxNotebook:getPage(Nb, 0),
%% P1 /= P2 /= PUnknown

Is this intended behaviour? I don't have a patch for this because I 
don't know what is expected

2) firstly, when calling wx_object:start_link/X and returning {stop, 
whatever} it exits the process. Why?
second, it patternmatches the return value (from the ack) to {ok, Pid}, 
again: Why? This causes the return value to exit with badmatch, I'm sure 
that is not intended? Or is it?

/Mazen


More information about the erlang-bugs mailing list