A Simple GUI version of "Hello World" in APLX
In APLX there are two approaches to creating a GUI application.
The first approach is to make use of the GUI classes built into the APLX interpreter. Here's a simple function "HelloWorld" which displays a window enclosing a single large button reading "Hello World". When clicked, the window closes and the function ends
HelloWorld;window
⍝
⍝ Simple demonstration of Hello World in a GUI environment using APLX
⍝
window←'⎕' ⎕NEW 'window' ⍝ Create the window
window.scale←5 ⍝ Sizes will be in pixels
window.caption←'Hello World with APL' ⍝ Set window title
window.button.New 'button' ⍝ Create the button
window.button.caption←'Hello World' ⍝ Set button text
window.button.font←'Arial Black' 48 ⍝ Use a nice big font
window.button.align ¯1 ⍝ Make the button fill the whole window
window.button.onClick 'window.close' ⍝ Set the expression to execute when
⍝ the button is clicked
0 0⍴⎕we window ⍝ Wait for window to closeThis has the advantage that it is cross-platform. It will work in APLX Version 4 under Windows, Macintosh OS X or Linux. Here's the Windows version running:
You can turn the application into a stand-alone executable that doesn't require the APL interpreter to run. First you need to set the Latent Expression which executes when the workspace is loaded:
⎕LX←'HelloWorld'
Then you need to save the workspace as a Packaged Application. Here's a screenshot taken from the Windows version of APLX:
As an alternative to using the built-in GUI classes in APLX, you can create windows and other objects using the .Net frameworks. This offers the maximum flexibility, but requires you to learn about .Net and restricts you to running under Windows. Here is the Hello World example using .Net
APL Wiki