1 / 19

wxErlang

wxErlang. Mats-Ola Persson. wxErlang. GUI library for Erlang write GUI applications cross platform cross platform look and feel. Example. A “stupid” tic-tac-toe application No intelligent behavior is implemented Just the (good) looks. Creating a window. create_window() ->

chastity
Download Presentation

wxErlang

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. wxErlang • Mats-Ola Persson

  2. wxErlang • GUI library for Erlang • write GUI applications • cross platform • cross platform look and feel

  3. Example • A “stupid” tic-tac-toe application • No intelligent behavior is implemented • Just the (good) looks

  4. Creating a window create_window() -> wx:start(), % initialize wxErlang % create a frame (window) with no parent Frame = wx:frame(?NULL, ?wxID_ANY, “Hello World!”), wx:show(Frame). % make the frame visible

  5. Creating a window • Not very exciting: an empty window

  6. Event-driven programming • Things “react” to mouse clicks, mouse movements, etc. • Event-handlers, callback functions

  7. Events create_window() -> wx:start(), Frame = wx:frame(?NULL, ?wxID_ANY, “Hello World!”), % event-handler that reacts to close clicks wx:connect(Frame, ?wxEVT_CLOSE_WINDOW, fun(_,_) -> wx:quit() end), wx:show(Frame).

  8. Layouts • Platform independent layouts • Sizers • No fixed sized widgets, etc. • Arbitrary complex layouts • Let’s add the buttons!

  9. Sizers create_grid(Frame) -> Grid = wx:grid_sizer(3), % a grid sizer with 3 cols create_buttons(Grid, Frame, 9), % create 9 buttons Grid. create_buttons(_, _, 0) -> ok;create_buttons(Grid, Frame, N) -> Button = wx:button(Frame, N), %a button without label wx:add(Grid, Button), % add button to the sizer create_buttons(Grid, Frame, N - 1).

  10. The result • A “shell” of a tic-tac-toe application

  11. wxEtop • Port of the old “etop” • New features • context menues • view running code • ...

  12. From the programmers point of view • wxErlang is verbose - like most GUI libraries • Trial-and-error - like most GUI libraries • Interface designers • XRCed, DialogBlocks, etc.

  13. Design decisions • Binding to the C++ GUI library wxWidgets • Get a lot for free • “free” features from wxWidgets • reduced maintenance work • wxErlang interface resembles wxWidgets C++ interface • free documentation(!)

  14. Translation scheme • Easy • Functions • Multiple return values => tuples • ... • Constants

  15. Translation scheme • Not as easy • Classes • Overloading and overriding functions • Type system

  16. Safety • Checks arguments • Types • Primitive values • Objects • Sanity

  17. Implementational details • Most of the code is generated from wxWidgets headers • Implemented as a “port program” • Has a lot of bugs

  18. Wrap up • Current status - a prototyp • wxEtop • Perhaps 10% implemented • Future

  19. Questions?

More Related