[erlang-questions] wxErlang question

John R. Ashmun john.ashmun@REDACTED
Thu Nov 1 22:48:55 CET 2018


I have written an interactive Erlang program which runs on Microsoft
Windows 10 & which makes use of wxErlang to open a window which contains
buttons for a user to click upon.  Their use is not problematic.

The window has a File menu with the single item "Quit" and of course it
also has a widget intended to be used to close it.  The use of these is
somewhat problematic:  If I select the "Quit" item, although the Erlang
process that created the window successfully receives the message

#wx{ id= ?EXIT,
        event = #wxCommand{ type = command_menu_selected } }

(where I used a

-define(EXIT, ?wxID_EXIT).

macro for some reason.)

and its matching clause apparently succeeds with its call to
wxWindow:close( ), in the Erlang shell there appears this message:

=ERROR REPORT==== 1-Nov-2018::14:01:34 ===
Supervisor received unexpected message: {wx,-202,
                                         {wx_ref,35,wxFrame,[]},
                                         [],
                                         {wxClose,close_window}}

My guess is that this report is generated by calling wxWindow:close( Frame,
[] ).

I don't understand what "Supervisor" is in this case.  Could it be the
process that spawned the process that creates the wxWindow?  The process
owning the window and handling the wxCommand event attempts to send a tuple
{ terminate } to a process in the application that started it, and this
appears to succeed, but only as a result of the Quit menu item -- if I
click on the window-closing widget, I see no action being taken, but it
turns out that the same ERROR REPORT has been queued somewhere; it appears
after I subsequently choose the Quit menu item, before the one generated by
choosing the Quit menu item.

I would like to learn how to eliminate the error report & how to get the
close widget to close the window and send the { terminate } tuple.

About the close_window event, the receive loop is looking for

  #wx{ id = ?CLOSE, event = #wxCommand{ type = close_window } }

where ?CLOSE is an alias for ?wxID_CLOSE

If I had any understanding of how to use Github from Windows 10, I would
happily make the sources available, but it's beyond me so far.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181101/8e1bc4da/attachment.htm>


More information about the erlang-questions mailing list