Congratulations! You now know:
How does one move from this place to becoming proficient with SWT and Clojure Desktop Toolkit?
SWT is a fairly large API. While its consistent use of conventions helps, each widget has its own nuances.
Further, being a native widget toolkit introduces its own complexities.
Here are some tactics and approaches that will help you manage this complexity as you learn.
Since SWT wraps native platform widgets, the order in which you receive what events will not be consistent across platforms! Here is a best practice to help manage this:
async-exec!
function within your event handler to queue a function that will execute your state changes after all pending events have completed!For example, if the user clicks the mouse on a text field to move the focus there, the user interface will generate a sequence of events something like:
Unless you're going to use event's doit
flag to block the traverse event from continuing, you will want to place any additional state changes after the mouse-up
event. The way to do this is via the async-exec!
function from mouse-down
or traverse event
so that your code runs after the final mouse-up
.
The docstrings for the ui
macro along with sync-exec!
and async-exec!
offer more color.
There's an encyclopedia of SWT code examples, organized by SWT widget! It's called the "SWT snippet" library over at Eclipse.org and it's amazing!
Using these examples, you can learn how to accomplish pretty much any esoteric thing using SWT!
The following section in the tutorial index introduces more of SWT's API and offers a quick reference guide to the current SWT API.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close