Code Master Blog

Code Mastery Takes Commitment To Bold Coding Adventures

Thursday, December 10, 2020

Glimmer Hello, Button! Sample (SWT & Opal)

Glimmer DSL for SWT 4.17.10.5 (JRuby Desktop Development GUI Framework) and Glimmer DSL for Opal 0.7.4 (Pure Ruby Web GUI & Auto-Webifer of Desktop Apps) have been released with support for a new sample: Hello, Button!

 

Notice how utterly simple and intuitive the code is. It is simply leveraging standard Ruby attributes on a class, data-binding to them in the GUI, and then using a block to customize the data-bound property on read from the attribute before displaying in the button text. Otherwise, the `on_widget_selected` event, which gets triggered on click of the button simply calls the `+=` operator in Ruby to do the increment work, and that automatically updates the text in the GUI. None of the web template mixing nonsense you see in web examples of it since it is written fully in pure Ruby, thanks to the Glimmer GUI DSL. As such, it is the most concise, understandable, and maintainable code for a button counter. Beautiful, isn't it?!

Happy Glimmering!

Andy Maleh at 8:44 AM
Share

No comments:

Post a Comment

‹
›
Home
View web version

Andy Maleh

My photo
Montreal, QC, Canada
Winner of Fukuoka Ruby 2022 Special Award. RubyConf / RailsConf / Agile / EclipseCon / EclipseWorld Speaker. MS in SE DePaul University (Chicago, IL, USA) and BS in CS McGill University (Montreal, Qc, Canada). OSS Author of Glimmer and Abstract Feature Branch. Primary Technologies: Ruby, Rails, Glimmer, Java SE/EE, Spring, HTML, JS, CSS, SWT, LibUI, Tcl/Tk, FOXToolkit, Swing, JavaFX. Drummer in Montreal Rock Band: MusiArt. Former Drummer in Chicago Rock Bands: Cletus Darby & Gag Order. Hobbies include Snowboarding, Longboarding, Curling, Softball, Volleyball, Basketball, and Bowling. Fan of the Boston Red Sox (MLB), Montreal Canadiens (NHL), Montreal Alouettes (CFL), and Montreal Alliance (CEBL). LCMS Born Again Evangelical Lutheran Protestant Christian.
View my complete profile
Powered by Blogger.