GUI development with Rust and GTK 4
51–60 of 172 posts
Re: GUI development with Rust and GTK 4
#52Rust GTK4 "hello world" app, as a downloadable project, demonstrating the builder pattern: https://github.com/SixArm/rust-guideposts/blob/main/projects...
Honestly this looks like programming style from 90s. Why not design UIs in an editor that saves layout to XML?
Speaking from a mobile dev's perspective, the native UI design in 2010s was done by XML based files (storybooks in iOS/macOS, XML layout files in Android) and native code would "connect" with the XML files in various ways. Now the development is moving towards declarative approach using frameworks such as SwiftUI and Compose.
This builder pattern resembles quite a bit of how you would declare UI in SwiftUI and Compose.
Re: GUI development with Rust and GTK 4
#53Earlier quoted context omitted.
There are plenty of situations where GTK might be better than Slint, but not so overwhelmingly that I'd call it only for toy apps.
While you can create one on your own, any lib that doesn't have a tree widget isn't ready for primetime IMO. Obviously others may have a different opinion. Also, I don't believe there is any way to embed a webview at this point which is often necessary to embed things like charts or other widgets you don't want to create on your own.
It’s shockingly difficult to find newer UI frameworks with this, even though it’s one of the most important desktop UI widgets for a lot of use cases. Win32, Cocoa, GTK, and Qt Widgets have it though, and that’s part of why those toolkits continue to get used.
Re: GUI development with Rust and GTK 4
#54Earlier quoted context omitted.
The apostrophe isn’t superfluous. ‘Static in this context refers to static lifetime. Lifetimes have absolutely 0 impact on runtime.
How would you get a static lifetime without a static object?
Re: GUI development with Rust and GTK 4
#55Earlier quoted context omitted.
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…
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,…
As I alluded in my other comment, theming is possible but it's really limited if you expect anything close to what you'd typically expect. You can put borders and colors on frames, but it's pretty limited. For example, if you want to have a border with different colors on each edge, or a border on just one edge, you can't do that by default. I had to make a custom frame object that is a frame in a frame to make different sized borders, but it's still a single color.
I created a mockup in PowerPoint (my go to design app... I'm not a designer, but it has everything I need and I know how to use it), and I had a lot of difficulty getting the egui design to match my PP design, because PP actually has a fairly advanced styling engine with a ton of options, and I took advantage of those. So when I go to egui, the default theme didn't support the kinds of design elements I wanted to show.
But, like I said, you can make these things yourself with the egui building blocks without much trouble.
The other thing I found a little frustrating was chromeless windows. There's an example of this, but it didn't seem well supported. The idea is that when you turn off chrome, you can't resize or close your app. So then you have to add all that functionality back. There's a demo that shows this, but it seemed like a pain at the time to integrate into my app. I gave hoping it would be fixed soon, so I will revisit.
Re: GUI development with Rust and GTK 4
#56Earlier 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,…
I need very flexible charting. While egui has some basic stuff builtin, I need something closer to what imgui-charts has (which makes imgui-rs a candidate for me, but probably not egui). A webview would also work as a fallback with a JS charting lib, but egui can't do that either.
I've only kicked the wheels a bit on egui, but for plotting signals it seemed more than adequate. Its histograms looked fine too. The only thing I saw missing was 3d plotting and heat maps.
Re: GUI development with Rust and GTK 4
#57I get the value of 100% (or 50% or 80%) implementing the UI in Rust; especially for tools that won't benefit from a native UI, or tools that only need light integration into platform-specific UI features.
I've also shipped a desktop product that had a 100% native UI and a cross-platform codebase. Today, implementing that cross-platform codebase in Rust and then importing it into native C# and Swift codebases for the Mac and Windows variants would be ideal.
Re: GUI development with Rust and GTK 4
#58Rust GTK4 "hello world" app, as a downloadable project, demonstrating the builder pattern: https://github.com/SixArm/rust-guideposts/blob/main/projects...
Honestly this looks like programming style from 90s. Why not design UIs in an editor that saves layout to XML?
https://gtk-rs.org/gtk4-rs/stable/latest/book/composite_temp...
Re: GUI development with Rust and GTK 4
#59At this rate programming languages will reinvent GUI builders from Delphi/Lazarus in 2050
I still find it quite sad that the pinnacle of GUI programming tools was reached over 20 years ago, when Delphi 6 was released, and we've been going more or less downhill ever since.
Re: GUI development with Rust and GTK 4
#60At this point, you might as well use Tauri.