[erlang-questions] Mysterious wxDialog:showModal/1 return value

Michael Turner michael.eugene.turner@REDACTED
Mon Apr 11 15:35:58 CEST 2011


Ah, thanks.  I should have guessed.

Now I'll see if there's a way I might have figured it out from the
documentation. :-(

I suppose it's a minor miracle that there was even *one* way to derive a
reasonably coherent API for wxWidgets, but it would have been nice if the
return value in this case could somehow have been *atom* wxID_OK rather than
macro value ?wxID_OK (which the Erlang shell can't see.)

One of these days I'll have to write a broadside, "Graphics as if Erlang
mattered".  I have this feeling that a really cool API is possible, one that
makes GUI-writing easier than in most languages, but just hasn't happened
yet.

-michael turner

On Mon, Apr 11, 2011 at 9:30 PM, Dan Gudmundsson <dgud@REDACTED> wrote:

> I don't know how it's supposed to work but from wx.hrl
> -define(wxID_OK, 5100).
>
> /Dan
>
> On Mon, Apr 11, 2011 at 1:41 PM, Michael Turner
> <michael.eugene.turner@REDACTED> wrote:
> > The documentation for wxDialog:showModal/1 promises (indirectly, anyway)
> > that
> >   "The return value is the value set with wxDialog::SetReturnCode."
> >
> > See http://docs.wxwidgets.org/stable/wx_wxdialog.html#wxdialogshowmodal
> >
> > But wxWidgets (at least as of R14B on Windows) doesn't seem to keep that
> > promise.
> > I put these lines into the shell:
> >   Wx= wx:new().
> >   F = wxFrame:new(Wx, -1, "A frame").
> >   wxFrame:show(F).
> >   D = wxMessageDialog:new (F, "Let's talk.").
> > When I asked for this:
> >   wxDialog:getReturnCode(D).
> > I got 0 (zero).  When I set it to 1
> >   wxDialog:setReturnCode(D,1).
> > I got "ok".  When I asked to see the value I'd set
> >   wxDialog:getReturnCode(D).
> > I got back 1 -- as I'd asked.  But when I did
> >    wxDialog:showModal(D).
> > and hit the OK button, the return value was 5100.
> > Why?  Is there some reason for this?  For my wxWidgets tutorial
> >   http://www.idiom.com/~turner/wxtut/wxwidgets.html
> > even if I'm stuck with 5100, I'd like, at the very least, to be able to
> > explain why it's 5100.  Does anybody know?
> > -michael turner
> > _______________________________________________
> > erlang-questions mailing list
> > 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/20110411/7cb75f68/attachment.htm>


More information about the erlang-questions mailing list