10 ms·
Native GUI library for Go
- GenKali 12y agoIs the readme supposed to look like that? The first few paragraphs are all 'h2' level text. Very difficult to read through.
- andlabs 12y agoI just replaced it with a detailed placeholder for now. (Replacing it was something I had stuck in the back of my mind for a while.)
- chris_wot 12y agoI'm interested in this because I'm cleaning up and restructuring LibreOffice's VCL (Visual Component Library) code. In terms of OO, it's a mess of tangled code. This might give me some ideas.
- oblio 12y agoYou brave soul. I hope you accomplish what you've started - LibreOffice GUI improvements, especially regarding the foundations, are greatly appreciated. Would it be possible, long term, to use Qt? I mean switch the current components to be based on Qt and then, over time, actually start using Qt?
- chris_wot 12y agoThere's already an effort underway. LO has a fundamental classes when it comes to implementing the VCL: OutputDevice, SalGraphics, SalFrame and SalInstance. Mainly SalGraphics and OutputDevice though. The problem is it is so intertwined, the biggest issue being that classes don't follow the Single Responsibility Principle. It's getting there, but I've only really done any real coding in anger in the last 5 months and this is a 25 year code base...
- fithisux 12y agoPlease do it in D. C++ is horrible. But if you insist in C++, isn't nana an option?
- andlabs 12y agoDoing it in another language would probably require rewriting the entirety of LibreOffice, which is a very massive project with code spanning at least a decade, if not more. They recently switched away from a proprietary (in the sense that only they used it) build system to one of the more conventional ones (I forget from what to what), so anything IS possible, but the question is whether it would be worth it. I know LibreOffice has some Java interoperability, but I don't know how much, or whether that could be leveraged.
- chris_wot 12y agoOh... we are trying to get away from a dependency on Java :( Nana looks interesting - I'm always looking at C++ toolkits to better understand how they work. I was looking at it's event system, seems pretty nice. gtkmm also has a nice signals system also. But yes, rewriting in D would be more than complex. LO has over 7 million lines of code, the real issue is that there is still a lot of cruft (e.g. the Resource class, tools, etc) and we are progressively working on removing this and replacing with saner libraries, such as boost. Interestingly, VCL actually works pretty much by itself. I recently resurrected some VCL demos and got them to work as standalone executables. VCL could actually be as clean to work with as nana, but the guts need a rewrite. And it would do it in a cross-platform way, but with largely native widgets.
- laumars 12y agoAnyone had chance to try this yet? Is it any good? I notice the Linux APIs call GTK which, while I can understand the logic of, I rather liked the Qt Go Bindings I played around with last year.
- fit2rule 12y agoIt is very rudimentary; all the basics are there, but there are some glaring things I couldn't figure out yet - like how to move the Window to a new screen position, things like that. Might be my ignorance though, I've only had 15 minutes of glance at it, and as I'm mostly interested in learning Go casually, maybe there's some things I've missed ..
- laumars 12y agoFair play. This is as good a project to learn Go with as any :)
- sparkie 12y agoIt may have been done with Wayland in mind, where there is no client-side way of setting the window position, or even querying it, since wayland does not let the client know. The position of windows is managed entirely by the wayland server.
- andlabs 12y agoWhile I do have Wayland in mind, that's specifically for what I can do with the GTK+ backend when running against GTK+'s limits. For this particular feature, there's a different rationale, but I can't remember what it was right now. That being said, I may add such a thing in the future (there's something in futureplans.md about centering the window right now, so...). And yes, this is still rather incomplete (I'm surprised it's getting so much attention this early!); please feel free to make suggestions!
- sagichmal 12y agoWith the caveats that I haven't used it yet, and that I don't know if it reflects actual product quality: after a skim, I can say the code itself is pretty messy. Randomly formatted, nonidiomatic naming conventions, lots of commented-out blocks and dead code, haphazardly organized.
- fit2rule 12y agoLooks like a decent effort at creating the basics - certainly usable for basic things like buttons and forms and such .. well, I appreciate the simplicity of this ui kit so far, as I'm currently learning Go. I'm enjoying learning what area_darwin.go/.m are doing .. toll-free bridge, k? (wakeup doesn't run with the current version though, missing window w in args, but that's an easy fix..) So from 10 minutes of looking at it and getting wakeup built, I've learned some new Go stuff. Thanks for that! :)
- sdegutis 12y agoAlthough I'm skeptical about this project (as I usually am with widget platform-native toolkits like this), I'm very interested about how it turns out. It looks like it's in early development, but the author seems to know his stuff. It would have been really cool to see back when I was first trying Go out, but I've since lost interest in Go since they're taking so long to implement generics, and I'm not interested in copy/pasting so much code. When I'm writing OS X apps (I don't use any other platform these days), writing in Swift seems like a much more fun option (too bad it's not open source, yet).
- grey-area 12y agoObjective-C doesn't have generics either and is/was the blessed API language on your chosen OS. The horror!
- anon1385 12y agoObj-C is 31 years old. I don't think it's unreasonable to expect new languages/frameworks to have progressed in that time.
- Artemis2 12y agoIsn't it normal to expect old languages to evolve too, especially when they are pushed forward by companies as huge as Apple? Look at C++ (the same age as Objective-C): C++11 was approved in 2011.
- incompatible 12y agoIt's amazing how many wheels need to be reinvented every time somebody introduces yet another language.
- mg74 12y agoServerSwift! SwiftPOSIX! SwiftToJS! SwiftGTK! KSwift! WinSwift! SwiftCurse!
- rabino 12y agoand the most important of all, 2048Swift, which of course happened already. https://news.ycombinator.com/item?id=7845441 https://news.ycombinator.com/item?id=7845441
- shawnps 12y agoDo you mean the author is reinventing the wheel because this already exists in other programming languages, or because there are many existing GUI libraries like this in Go already? It's likely there are many people who are most comfortable writing Go recently so I don't understand how this is a problem.
- feadog 12y agoSome folks at Microsoft were trying to circumvent this with Singularity OS being based on something like CLR. Then everything could dynamically interoperate with everything on a programming language level. http://xkcd.com/927/ http://xkcd.com/927/
- andlabs 12y agoIf I recall correctly, the point of Singularity wasn't to have a platform base where all programming languages shared the same infrastructure, but rather to have an operating system that ran (almost) entirely in "managed code" (the .net framework's safe-execution system). .net itself is what you're thinking of.
- skriticos2 12y agoWhy do people hate images and videos so much? It's a GUI library! I skimmed the whole readme and have no idea what it looks like and found no link that would make me any smarter. Am I weird in this regard?
- quarterto 12y agoIt's platform-native. It looks like your platform. What else do you need to know?
- shawnz 12y agoThere are a million different ways to look "platform-native". I'd like to know what exactly they got right and what they got wrong before simply jumping in.
- andlabs 12y agoFor the record, and this applies to all comments above and below: by "platform-native" for this package, I do no custom drawing; everything is deferred out to the underlying system APIs. So this actually uses Cocoa on Mac OS X (you can see the .m files as well) and the Windows API on Windows (which is part of the reason I didn't go with just having Qt bindings).
- FooBarWidget 12y agowxWidgets and <del>Swing</del>SWT are also platform-native. Now find me a single wxWidgets and SWT app that doesn't look slightly off on Linux and OS X. Looking and feeling native involves so much more than just using native controls.
- gldsmth 12y agoSwing is NOT platform native, that's why SWT was developed in the first place. Swing can use native look-a-like theming but it's not the same thing as SWT's actual, truly native widgets (with native keyboard shortcuts, system services..). wxWidgets and SWT are about as native at it can be in a cross platform GUI library. I don't see why you'd need a screenshot of the go library, it would look the same as a typical wxWidgets or SWT app, which is to say, it uses native controls, but might not be designed according to the "common" UI conventions of the platform.
- crawshaw 12y agoAn easier way of looking at the API: http://godoc.org/github.com/andlabs/ui http://godoc.org/github.com/andlabs/ui
- Hansi 12y agoReadme, check. Docs, check. Screenshots, nope. Why would you not include that for a gui library?
- tptacek 12y agoStupid programmers with their writing code instead of making pictures.
- danudey 12y agoIs it unreasonable to expect some kind of demonstration of what the code will accomplish before having to actually write a project which uses it? If this code works and is tested on OS X, Windows, and Linux, then one would assume the author has at least one test implementation, so it wouldn't be too far of a stretch to screenshot it, especially given that cross-platform toolkits have never, in my experience, actually looked or felt native on OS X.
- tptacek 12y agoPeople on HN have a very bad habit of assuming that any time something appears on HN, it's because the authors wanted to put on a show for HN. No.
- shadowmint 12y agoOh please, what kind of excuse is that? This library is clearly not written for the authors own personal benefit. Just look at the old readme; it's obviously written for other people to use and play with. Examples and screenshots are good; there's no reason for anyone to be defensive about not having them; the author can just add them. It's no big deal; it's helpful feedback.
- andlabs 12y agoPartially true; I was driven to write this because I wasn't particularly satisfied with what already existed for various differing reasons. The current feature set and my own short-term plans are based around the GUI projects that I intend to write first (specifically a music authoring program). As for screenshots, I suppose I could upload a screenshot of the test program, but I'm not sure how much that would accomplish. I think a basic tutorial with screenshots at each step would probably be more useful, as it shows how the package works...
- CmonDev 12y agoCould be a good Go-alternative of Xamarin in ~5 years or so.
- laurent123456 12y agoThough it's great to a see a new GUI library for Go, I'm wondering if it's following the best approach. Most frameworks seem to be moving towards more declarative languages (HTML for many platforms, QML for Qt), often mixed with JS, and it makes it much easier to create GUI. Not sure if we need another clone of wxWidgets/QtWidgets. I wonder if something like a native QML interpreter in Go would be possible.
- grose 12y agoCheck this out: https://github.com/go-qml/qml https://github.com/go-qml/qml It's written by the same guy who made the awesome MongoDB driver for Go, so I have high hopes!
- andlabs 12y agogo-qml has already stirred up enough interest for that same guy to run a program-making contest at the recent GopherCon so I guess it's safe to say your hopes are reasonable =P
- andlabs 12y agolinks to the contest, thanks Nate Finch: http://blog.labix.org/2014/03/13/go-qml-contest http://blog.labix.org/2014/03/13/go-qml-contest http://blog.labix.org/2014/04/25/qml-contest-results http://blog.labix.org/2014/04/25/qml-contest-results