www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - slint GUI, for RUST, C++, nodejs, dotnet. cloud add Dlang support

reply d007 <d007 gmail.com> writes:
https://github.com/slint-ui/slint


slint UI support desktop and embed device, and mobile device in 
future.


https://github.com/microhobby/slint-dotnet compiler 
implement,  maybe sone one is capable to translate this into 
dlang ?
Oct 13 2023
parent reply ryuukk_ <ryuukk.dev gmail.com> writes:
On Friday, 13 October 2023 at 12:44:57 UTC, d007 wrote:
 https://github.com/slint-ui/slint


 slint UI support desktop and embed device, and mobile device in 
 future.


https://github.com/microhobby/slint-dotnet 
 compiler implement,  maybe sone one is capable to translate 
 this into dlang ?
I don't understand why slint is popular, it's one of the worst library out there, and it uses a custom scripting language Just look at the generator, it's very basic: https://github.com/microhobby/slint-dotnet/blob/main/SlintDotnet/Generator.cs The resulting API however.. very ugly: https://github.com/microhobby/slint-dotnet/blob/main/test/Program.cs Can't really call this a binding If you do embedded work, I suggest lvgl (no scripting, so you can fully make use of powerful D's capabilities): https://github.com/lvgl/lvgl in pure C
Oct 13 2023
next sibling parent d007 <d007 gmail.com> writes:
On Friday, 13 October 2023 at 15:09:27 UTC, ryuukk_ wrote:
 I don't understand why slint is popular, it's one of the worst 
 library out there, and it uses a custom scripting language

 Just look at the generator, it's very basic: 
 https://github.com/microhobby/slint-dotnet/blob/main/SlintDotnet/Generator.cs

 The resulting API however.. very ugly: 
 https://github.com/microhobby/slint-dotnet/blob/main/test/Program.cs

 Can't really call this a binding

 If you do embedded work, I suggest lvgl (no scripting, so you 
 can fully make use of powerful D's capabilities): 
 https://github.com/lvgl/lvgl in pure C
lvgl is great. I guess slint is used to tanslate target language. for example we translate vide.d template into dlang source code, then pass to dmd compile. Slint allow us use live preview to design the UI, and generate execute binary direct from target language code. this can guaranteed the best performance and flexibility, and the results binary size is also very small (if we use betterC for this case). for example a slint c++ project result around 200KB binary.
Oct 13 2023
prev sibling parent reply Tobias Hunger <tobias.hunger slint.dev> writes:
I stumbled into this thread on Google, I have tried D about a 
decade ago but did not stick around. I do contribute to slint 
though.

On Friday, 13 October 2023 at 15:09:27 UTC, ryuukk_ wrote:
https://github.com/microhobby/slint-dotnet 
 compiler implement,  maybe sone one is capable to translate 
 this into dlang ?
There are also C++ and JS bindings. Especially the C++ one is further along.
 I don't understand why slint is popular, it's one of the worst 
 library out there, and it uses a custom scripting language
What makes you say so? I consider the description language to be a huge plus: It allows us to have a design tool, a live preview and allows non-programmers to design and update the UI. That code is compiled into native code (rust, c++, ...), using a small runtime library written in rust. Nothing gets interpreted (well, we do have an interpreter, too). It is not a scripting language on purpose, more a description language. Think more HTML than JS. https://slintpad.com/ has an online editor if you want to play with it. Basically you describe the UI and an interface into the host language (properties, functions and callbacks). As long as that interface does not change, a dev can not break the UI and a UI designer can not break the business logic. I love that part:-)
 Just look at the generator, it's very basic: 
 https://github.com/microhobby/slint-dotnet/blob/main/SlintDotnet/Generator.cs

 The resulting API however.. very ugly: 
 https://github.com/microhobby/slint-dotnet/blob/main/test/Program.cs
That code has a lot of code in there demoing all kinds of things you will typically not do in an application. A typical application usually creates the UI, sets a few properties and callbacks to bind the business logik to the UI and then calls run().
 Can't really call this a binding
I was very impressed by it: It works(TM) and was done by one person without involving anyone from the core team in a few weeks.
Oct 14 2023
parent reply Tobias Hunger <tobias.hunger slint.dev> writes:
PS: The generator code linked above just "renders" out the 

heavy lifting in the background.

That is what you need to support a new language. We would then 
build a nicer facade in the supported language around that.
Oct 14 2023
parent reply d007 <d007 gmail.com> writes:
On Saturday, 14 October 2023 at 08:58:23 UTC, Tobias Hunger wrote:
 PS: The generator code linked above just "renders" out the 

 heavy lifting in the background.

 That is what you need to support a new language. We would then 
 build a nicer facade in the supported language around that.
Thanks for the explain. Correct me if I am wrong. The Slint c++ version not need link into any object binary generate by rust ? (or need link into a static library build from rust?)
Oct 14 2023
parent reply Tobias Hunger <tobias.hunger slint.dev> writes:
On Saturday, 14 October 2023 at 11:32:56 UTC, d007 wrote:
 Correct me if I am wrong.

 The Slint c++ version not need link into any object binary 
 generate by rust ?  (or need link into a static library build 
 from rust?)
The slint code is turned into C++ code. That code calls into a small runtime library written in Rust. That library exposes a classic C-style interface. There is more c++ code that provides C++ types to conveniently work with the generated code, which either wraps more of that rust library or just re-implements parts of it in c++.
Oct 14 2023
parent reply d007 <d007 gmail.com> writes:
On Saturday, 14 October 2023 at 11:52:00 UTC, Tobias Hunger wrote:
 The slint code is turned into C++ code. That code calls into a 
 small runtime library written in Rust. That library exposes a 
 classic C-style interface.

 There is more c++ code that provides C++ types to conveniently 
 work with the generated code, which either wraps more of that 
 rust library or just re-implements parts of it in c++.
Thanks for explain. I believe Slint will work for D as well as C++. D is able to call C-style interface function direct, and has a great type system to work with rust type.
Oct 14 2023
parent reply Tobias Hunger <tobias.hunger slint.dev> writes:
On Saturday, 14 October 2023 at 15:19:46 UTC, d007 wrote:
 I believe Slint will work for D as well as C++. D is able to 
 call C-style interface function direct, and has a great type 
 system to work with rust type.
Everything is able to call C-style interface functions:-) Getting some basic support rolling should be very doable in dlang (but again, I looked into D about a decade ago and never used it beyond toy applications). The challenge is going beyond the basic support, building something that feels native to dlang developers.
Oct 14 2023
parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 15/10/2023 4:32 AM, Tobias Hunger wrote:
 Everything is able to call C-style interface functions:-)
 
 Getting some basic support rolling should be very doable in dlang (but 
 again, I looked into D about a decade ago and never used it beyond toy 
 applications). The challenge is going beyond the basic support, building 
 something that feels native to dlang developers.
It'll be worth looking at gtkd as they generate D bindings + wrapper for gtk. Which appears to be pretty much what you're trying to do. https://github.com/gtkd-developers/GtkD
Oct 14 2023
parent reply d007 <d007 gmail.com> writes:
On Saturday, 14 October 2023 at 15:43:44 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
 It'll be worth looking at gtkd as they generate D bindings + 
 wrapper for gtk. Which appears to be pretty much what you're 
 trying to do.

 https://github.com/gtkd-developers/GtkD
Thanks for the tips. GtkD is great if only target for linux users. If you want to make some product for public, you need to redo your logic form all other platfrom (macOS, windows, mobiles).
Oct 14 2023
parent Martyn <martyn.developer googlemail.com> writes:
On Saturday, 14 October 2023 at 16:27:57 UTC, d007 wrote:
 On Saturday, 14 October 2023 at 15:43:44 UTC, Richard (Rikki) 
 Andrew Cattermole wrote:
 It'll be worth looking at gtkd as they generate D bindings + 
 wrapper for gtk. Which appears to be pretty much what you're 
 trying to do.

 https://github.com/gtkd-developers/GtkD
Thanks for the tips. GtkD is great if only target for linux users. If you want to make some product for public, you need to redo your logic form all other platfrom (macOS, windows, mobiles).
I experimented on a project with gtkD. My tests -- they both looked exactly the same on Windows and GNU/Linux. Is what you refer to as a Gtk issue from past days? Maybe there are some gotchas when doing cross platform. Something I did not experience. My project had:- a login page, and "main" page. Consisting on text boxes, labels, buttons, etc. Plus was using CSS to style it. (Cannot comment on Mac, though - dont have one)
Oct 18 2023