Earlier quoted context omitted.
One argument I've heard for this model is that, by having the UI in a declarative language, the design team can update/experiment with the layout without having to understand the backing logic. I've only been on one team that actually subscribed to this model though.
I've heard this, but in practice it is hard to fully decouple the interface from the logic so experimentation with the front end usually involves work on the back end. Even simple changes like "we want to change this drop down to a set of radio buttons" ends up requiring changes on the back end most of the time.
GUI development with Rust and GTK 4
131–140 of 172 posts
Re: GUI development with Rust and GTK 4
#132Earlier quoted context omitted.
I really like XML a lot ; I've gotten large numbers of people to use XML & XSLT, where I work. XML is dated, and it is gross. Here's the two things the XML ecosystem nailed , which tie me to it: 1. A dedicated tree-based transformation language (XSL); and, 2. Axis-queries (Xpath). If I could Xpath all-the-things, I'd be a happier human. Although, I also feel like I should be able to SQL all-the-things, too. Maybe I'm…
XSLT is garbage tho.
Re: GUI development with Rust and GTK 4
#133Has anyone gotten GTK to compile on Windows without using MSYS? I would love to use pygobject with Python but the build chain and how to get it working is extremely confusing to me. Back in the days of gtk2, pygtk2 used to work wonderfully and compiled with MSVC
It's a hidden gem, but gvsbuild [1] has made it easier again these days - I just discovered it ~a year ago and it's beautiful :) [1] https://github.com/wingtk/gvsbuild
Re: GUI development with Rust and GTK 4
#134Earlier quoted context omitted.
Native look and feel is vastly overrated imo. Delphi and before it borland builder made for great UIs despite not looking native. To the point that when I came across that widget set, I knew I was in for a good UX. Still many bespoke interfaces, like at a brakes repair or small lumber yard chain use delphi and it works just fine. As for the webview, thats a thing, but if you will have web access, you can target wasm,…
Since you link to the the web demo, I want to caution people: yes, egui can run on the web, but treat that as a demo only done over the web for the convenience of not having to download and run it natively. If you’re making something, do not use egui if you want to actively target the web, because it’s really bad there in fundamentally unfixable ways (given egui’s architecture). Egui is quite compelling on non-web pl…
Re: GUI development with Rust and GTK 4
#135AFAIK, for better or worse, this is the only UI crate (other than HTML-like UI using something like Tauri) that provides a full set of widgets/capabilities on Rust. Every other UI lib is incomplete in some way or falls short for anything other than a toy or specialty type app in my experience. UPDATE: Things I have my eye on as they mature: Slint, egui, and iced. I'm especially watching iced as Pop_os is using it for…
For me the litmus test is if it has a fully-featured listview or treeview, so you can do something like a file browser, a library app, or other kinds of data-heavy apps. Also important is that keyboard and mouse work as expected (tabbing, shift-selection, etc). Bonus if it supports the current "native" OS paradigms. E.g. on Mac: transparent sidebar, integrated titlebar, on Windows: MS office 2022 style simplified too…
Re: GUI development with Rust and GTK 4
#136If you're like me and like pictures in your books: https://docs.gtk.org/gtk4/visual_index.html
final class Gtk.Label : Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget { /* No available fields */ }
What language is that in?
Re: GUI development with Rust and GTK 4
#137Earlier quoted context omitted.
I think egui is complete enough to use in real apps. Layout can be a bit weird, but I haven't found anything that's impossible. I might even prefer it for cross-platform apps since startup time is so slow for GTK on Windows.
The challenge with egui is the theme. It looks ok, but isn't good enough for a commercial business app for example. Also, I believe it lacks a webview, so if you are in a pinch the only thing you can do is create your own widgets without a way to cheat and embed some web content. I would agree for certain types of apps it may be "good enough" (science, gaming, medical perhaps...anything where the UI is secondary to t…
Re: GUI development with Rust and GTK 4
#138Oops. The borrow checker is going to beat you over the head. And beginners aren't likely to understand that it isn't their fault.
Rust needs to figure out a way to do GUIs ergonomically without requiring closures.
Re: GUI development with Rust and GTK 4
#139Great! So, let's refactor that UI code out into a function. Something a beginner is very likely to do as that code becomes more complex. Oops. The borrow checker is going to beat you over the head. And beginners aren't likely to understand that it isn't their fault . Rust needs to figure out a way to do GUIs ergonomically without requiring closures.
Re: GUI development with Rust and GTK 4
#140Great! So, let's refactor that UI code out into a function. Something a beginner is very likely to do as that code becomes more complex. Oops. The borrow checker is going to beat you over the head. And beginners aren't likely to understand that it isn't their fault . Rust needs to figure out a way to do GUIs ergonomically without requiring closures.
Which UI code specifically are you referring to and why would the borrow checker prevent you from factoring it out?
But here: https://github.com/gtk-rs/gtk4-rs/blob/master/examples/text_...
and here: https://github.com/gtk-rs/gtk4-rs/blob/master/examples/clock...
The moment some poor slob of a beginner tries to refactor any of those closures into a "normal" function, they're going to get beat over the head by the borrow checker.
Yes, I know why they're required in Rust. And it makes sense once you know Rust well. But a beginner isn't likely to understand why they can't refactor a closure into a function in Rust without a whole lot of clone().
Coding "examples" for Rust need to stop using that closure style--especially in "beginner" code.