[erlang-questions] wxErlang question 6 - Image display

Joe Armstrong erlang@REDACTED
Sat Jul 8 15:14:05 CEST 2017


Images

wxWidgets is breaking the principle of least astonishment

I've been making a load of widgets and adding them to a Vbox
which arranges them in a vertical stack.

To make a button

    Button = wxButton:new(Panel, Id, [{label,"My New Button"}]),
    wxSizer:add(Vbox, Button, ...)

To make a text editor

    Button = wxTextCtrl:new(Panel, Id, ...),
    wxSizer:add(Vbox, Editor, ...)

To make a combo box

     Combo = wxComboBox:new(Panel, Id, ..),
     wxSizer:add(Vbox, Combo, ...)

and so on.

At this point I began thinking "I'm beginng to understand this stuff" but ...

I thought I'd add an image, so I tried this:

    Image = wxImage:new("image.jpg", []),
    wxSizer:add(Vbox, Image, ...)

But oh dear - this doesn't work.

I Googled a bit - and it appears I have to mess with paint events and
graphics contexts and so on.

But why? - why break the principle of least atonishment.

Is it possible to dispay an Image in a Panel *without* handling graphics context
and paint events?



More information about the erlang-questions mailing list