Test if weave-tangle.r works
This file is intended to test out the literate programming environment based on MakeDoc3 and created by Gabriele Santilli.
The current section has no code.
We're going to create a simple REBOL program that includes a couple function and a GUI. The program just sends an email to some address.
〈Main code section〉 ≡
〈Definition of functions〉
view layout [〈Main GUI layout〉]
We define the do-send function, that reads the contents of the UI fields and sends the email. In case of error, an alert is displayed to the user.
〈Definition of functions〉 ≡
do-send: has [email message] [
email: to email! f-email/text
message: f-message/text
if error? try [send email message] [
alert "Error sending message."
]
]
This section discusses the main window layout. The layout block defines the label style, then creates a field, an area and two buttons. The code is so trivial that seems very silly to describe it. ;)
〈Main GUI layout〉 ≡
〈Styles for the main layout〉
across
label "To:" f-email: field return
label "Message:" f-message: area return
label btn-enter "Send" [do-send] btn-cancel "Quit" [quit]
This section defines the styles used in the main layout block.
〈Styles for the main layout〉 ≡
style label text right 80