There are a ton of wordpress plugins for flickr but it seems they can only embed a thumbnails gallery, not several whole size pictures. So I decided to create this small utility in Rebol: each time I will click on the client area of the application, it will generate an img link and add it to a list of other links. When I will right-click on the client area, it will copy the whole list of image links to the clipboard so that I can finally paste them in my wordpress post.
This will allow us to get an introduction to Rebol’s Event Handlers.
Install and launch Rebol’s console if not done already and copy and paste the code below:
view layout [
box "Click or Right-Click" forest feel [
engage: func [face action event] [
print action
]
]
]
Engage is a Callback function called by the system whenever an event occurs for a face (Visual Objects like button, box, …). This function handles events like mouse down, up, alt-down, double-click, timers, keyboard keys and more.
If you left-click and then right-click on the box area, Rebol’s console will print “down” and “up” events for the left-click and the “alt-down” and “alt-up” events for the right-click event:

Now let’s read and write the clipboard:
clipboard-content: []
view layout [
box "Click or Right-Click" forest feel [
engage: func [face action event] [
if (action = 'up) [append clipboard-content join "<img src=" [x: read clipboard:// ">" newline]
print x
]
if (action = 'alt-up) [write clipboard:// form clipboard-content
print clipboard-content
]
]
]
]
You can then test with 2 flickr urls:

You can download or execute the code above the internet by typing in Rebol’s Console:
do http://reboltutorial.com/source/flickr.r
Reference: How to Handle User Interface Events















No comments yet.