Size: 527
Comment:
|
Size: 1650
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= "Hello world" with a GUI = Using the APL's built in GUI interface we can build a Hello world form. |
|
Line 2: | Line 6: |
HelloWorld;ref;btn;myFnt | HelloWorld;ref;btn;myFnt |
Line 4: | Line 8: |
ref←⎕NEW'Form'(⊂'Caption' 'Hello World with APL') ref.Coord←'Pixel' myFnt←⎕NEW'Font'(('Pname' 'Arial Black')('Size' 48)) btn←ref.⎕NEW'Button'(('Caption' 'Hello World')('Posn'(0 0))('Size'ref.Size)) btn.FontObj←myFnt btn.onSelect←1 ⎕DQ'.' |
ref←⎕NEW⊂'Form' ⍝ Create a form with default parameters ref.Caption←'Hello World with APL' ⍝ Set the caption ref.Coord←'Pixel' ⍝ Deal with pixels myFnt←⎕NEW⊂'Font' ⍝ Create a font myFnt.Pname←'Arial Black' ⍝ Which one myFnt.Size←48 ⍝ Setting the font size btn←ref.⎕NEW⊂'Button' ⍝ Create a button btn.Caption←'Hello World' ⍝ Set the caption of the button btn.Posn←0 0 ⍝ Set the position of the button btn.Size←ref.Size ⍝ Make the button the same size as the form btn.FontObj←myFnt ⍝ Associated the font with the button btn.onSelect←1 ⍝ Interrupt when button is pressed ⎕DQ'.' ⍝ Give control to the user |
Line 13: | Line 27: |
This is inline {{{⎕LX←'HelloWorld'}}} APL | Setting the system variable (⎕LX) to 'HelloWorld' and saving the workspace ensures that this code is executed automatically when our program is loaded. |
Line 17: | Line 31: |
attachment:helloworld.jpg | {{attachment:helloworld.jpg}} |
Line 19: | Line 33: |
To make our program runnable we can select the File|Export menu command to make a bound executable whose name we can type into the Run... dialog. | |
Line 20: | Line 35: |
{{attachment:makehelloworld.jpg}} | |
Line 21: | Line 37: |
CategoryHelloWorld |
Page created by Phil Last in 2008-02-26 ---- CategoryHelloWorld - CategoryDyalog |
"Hello world" with a GUI
Using the APL's built in GUI interface we can build a Hello world form.
HelloWorld;ref;btn;myFnt ⍝ Build up a GUI and display "Hello world" in a button on a Form ref←⎕NEW⊂'Form' ⍝ Create a form with default parameters ref.Caption←'Hello World with APL' ⍝ Set the caption ref.Coord←'Pixel' ⍝ Deal with pixels myFnt←⎕NEW⊂'Font' ⍝ Create a font myFnt.Pname←'Arial Black' ⍝ Which one myFnt.Size←48 ⍝ Setting the font size btn←ref.⎕NEW⊂'Button' ⍝ Create a button btn.Caption←'Hello World' ⍝ Set the caption of the button btn.Posn←0 0 ⍝ Set the position of the button btn.Size←ref.Size ⍝ Make the button the same size as the form btn.FontObj←myFnt ⍝ Associated the font with the button btn.onSelect←1 ⍝ Interrupt when button is pressed ⎕DQ'.' ⍝ Give control to the user
Setting the system variable (⎕LX) to 'HelloWorld' and saving the workspace ensures that this code is executed automatically when our program is loaded.
This program will result in this form:
To make our program runnable we can select the File|Export menu command to make a bound executable whose name we can type into the Run... dialog.
Page created by Phil Last in 2008-02-26