kerryb

kerryb

WxEx – Elixir wrappers for macros and records in :wx

I’m not sure how many people are using wxWidgets in Elixir, but in the course of playing around with it I created a small library to expose the Erlang macros and record definitions to Erlang code.

It doesn’t wrap any of the :wx modules, because they can be used directly from Elixir.

I haven’t actually used it in any real projects yet, so if you find anything wrong or missing, feel free to raise an issue.

Thanks to @harrisi for managing to find it before I’d shown it to anyone, and submitting a PR to add OpenGL constants!

https://github.com/kerryb/wx_ex

Most Liked

cmo

cmo

I tend to think it should be kept the same because a) is easier to write the code (I have a similar script that allows access to the wx Erlang constants) and b) searching the WxWidget docs is easier when the names are the same.

@kerryb what’s the point of the WxObject wrapper if everything else apart from the constants is Erlang syntax?

christhekeele

christhekeele

For those interested I did recently do this, for all 25,000 lines of related constants, mostly through some multi-cursor editing and find/replace regexes. src/ files here.

kerryb

kerryb

In my opinion you should follow Elixir’s naming convention, so all of the macros and functions should be snake case.

The main reason I didn’t do that was … well, laziness to be honest, but also I’ve used tools before (eg Java and Ruby bridges to Apple’s Cocoa) where having to keep mentally translating the names of things when reading documentation was confusing.

I understand that it’s for a reason, so instead of converting it to snake case I would rather fit it in Elixir’s standards, for example a call like:

wxALIGN_RIGHT()

could be changed to:

wx(:ALIGN_RIGHT)

I do like that idea – it seems nicer than polluting the namespace by importing hundreds of functions into a module.

Maybe you could use more clear example usage here.

Yes, good point – I just pasted some snippets from a code sample I’d converted, assuming that if anyone was interested they’d already be far more familiar with wx than I am. I ought to replace it with a working “hello world” example.

Where Next?

Popular in Announcing Top

asiniy
Hey there! I wrote a download elixir package which does exactly what its name about - an easy way to download files. I saw solutions ab...
New
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
ityonemo
Currently just starting out on a new mini-project - getting zig NIFs to run in elixir. https://github.com/ityonemo/zigler The idea here...
New
kip
ex_cldr provides localisation and internationalisation support based upon the data from the Unicode CLDR project. Unicode released CLDR ...
407 13014 120
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
mindok
What is ContEx? A pure Elixir server-side data plotting/charting library outputting SVG. It has nice barcharts in particular and works g...
New
Jskalc
Hi! Today, after a couple weeks of development I’ve released v0.1 of LiveVue. It’s a seamless integration of Vue and Phoenix LiveView, i...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New
OvermindDL1
Been making an MLElixir thing (not released yet…) for fun in spare time in the past day. I’m just trying to see how much I can get an ML...
132 14057 106
New
New

Other popular topics Top

AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31013 112
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36352 110
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement