Live data from Hacker News

Ask HN: How do you create a cross-platform GUI without using Electron?

news.ycombinator.com

41–50 of 112 posts

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#42

I'm not the best person to explain or recommend it, but I'll suggest "immediate mode" GUIs partially because I want to hear more about the pros/cons from those more experienced (I haven't ever worked on UIs professionally). It seems these graphics libraries just need some kind of context to draw to, like from OpenGL, and also have a simpler implementation in general. That might make them more portable and smaller, if…

I love IMGUIs but you have to be careful with the to get them to play nice with the event loop. If you're using it for a game where you're drawing every frame anyways, they're great. But for something that the user might keep running alongside other apps they can be a cpu/memory hog. You can of course only process/redraw when an event happens but that can be easier said than done sometimes.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#43
We write apps like this in Object Pascal using Lazarus. Think Delphi but open source.

We have a suite of framework-specific developer apps for tasks like packaging deployments, managing common database tasks, onboarding new clients etc. They were written on Linux using Lazarus, then recompiled on MacOS and Windows as required. There are occasionally OS-specific variations for small pieces of these apps, but Object Pascal has inline compiler switches to make this easy to manage.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#44
In Solvespace we use native GUI on Windows, MacOS, and Linux (GTK). This is probably not what you want to do, as we don't use any GUI widgets - only popup dialogs and menus. Everything in the app itself is rendered using OpenGL. Even our "text window" is drawn using OpenGL and GNU unifont (this is something that really needs to change BTW).

The platform abstraction code is here: https://github.com/solvespace/solvespace/tree/master/src/pla...

There is no other platform specific code anywhere in the app, but like I said above we don't support widgets.

There is also an emscripten port in a branch, but it doesn't want to build recently.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#45
post #34

Delphi, believe it or not. Might even be the most mature and feature-rich of any of the technologies and frameworks mentioned here. RAD Studio 11 just got released and allows native development for "all platforms" from a single codebase and GUI at the click of a button. [0] I have ranted about and harshly criticised Embarcadero's misguided product policies as much as the next guy but that doesn't change the fact that…

Have you tried Free Pascal with Lazarus[1]? How does it stack up compared to Delphi? [1] https://www.lazarus-ide.org/

I like Lazarus and I think it's great and important that it exists, especially with Embarcadero refusing to recognise and take seriously the needs of a developer community outside of Fortune 500 orgs (I'm slightly exaggerating but not much).

Lazarus is Free Software, which is awesome, and its feature set is also mature and impressive (I wouldn't have thought that the project also has a 20+ year history already).

I do recommend it highly if you can't get your hands on Delphi, don't want to support Embarcadero's antics, or work with an open-source project anyway. Several major component developers, including the great guys at TMS with their cloud pack and Raspberry Pi components [0] make a ton of awesome components that are available for both Delphi and Lazarus and I can highly recommend them.

If you're operating in the commercial space and have a budget, a bigger team, strong network, database or certain other commercial requirements, you might appreciate the support options and greater choice of 3rd party components which can be installed in Delphi with just a click and that save just so, so much time in getting your product to market.

If you're learning or teaching the language, working in a small team or alone, or require a feature set fully supported by Lazarus or just like free software, I wholeheartedly recommend Lazarus as a great alternative indeed. If you're somehow in the middle, check out the Delphi Community Edition too and just find out what suits you better. I guess it also comes down to what you're used to...

[0] https://www.tmssoftware.com/site/products.asp?t=lcl

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#47
So just for the sake of completeness, maybe, and since Electron seems to be the most popular solution; what about a website? Fairly ubiquitous across all platforms with the help of Chrome, Firefox, and even Safari or Edge. I don’t think should be dismissed as often as is, consider VS Code on Github.com (hit the period key in a repo and the repo’s code is presented with VS Code in a browser — and it supports syncing extensions — though not all, for example).

To me it makes sense from tne perspective of the work being done in HTML, CSS & JS to make an Electron app. Why not start as a website then desktop?

I get there are certain pieces of functionality not suited for a website; but based on the original post’s question and description it seems feasible.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#48

Delphi, believe it or not. Might even be the most mature and feature-rich of any of the technologies and frameworks mentioned here. RAD Studio 11 just got released and allows native development for "all platforms" from a single codebase and GUI at the click of a button. [0] I have ranted about and harshly criticised Embarcadero's misguided product policies as much as the next guy but that doesn't change the fact that…

Does the community edition work on linux, or compile to linux? The page says:

> Delphi Community Edition is a full featured IDE for building iOS, Android, Windows and macOS apps ...

But looking at the feature matrix for the full product it says:

> deploy to the platforms you need to support and with RAD Studio that includes Windows, macOS, iOS, Android and Linux!

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#49

One word: Lazarus. Cross platform done right (native code, no intepreter, no VM). Both IDE and generated code run native just about everywhere, from small ARM boards to virtual machines, and of course x86. As fast as C, decent sized executables, lots of built in or available libraries and components to do a lot of things, from managing databases to low level access to hardware, graphics, sound, etc. And of course it'…

What's the Lazarus experience like for cross-compiling to other platforms? E.G. how hard is it to build a working result for Windows, OSX and Linux (maybe BSD) from Linux or BSD?

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#50
post #47

So just for the sake of completeness, maybe, and since Electron seems to be the most popular solution; what about a website? Fairly ubiquitous across all platforms with the help of Chrome, Firefox, and even Safari or Edge. I don’t think should be dismissed as often as is, consider VS Code on Github.com (hit the period key in a repo and the repo’s code is presented with VS Code in a browser — and it supports syncing e…

I need to read/write to the filesystem, think the app is like a personal document manager. Also will like to associate filetypes with it, and for the most important thing is being able to send notifications and make sure my backend is syncing data all the time
Post reply on HN