Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Cross-platform GUIs?

  1. Dec 12, 2003 #1

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Well, I have an app that I'd like to write in C/C++ on both Linux and Windows, and be able to use the same GUI code on both.

    I have never taken the time to learn Windows GDI programming, and, from the looks of it, I don't want to.

    My first instinct was Qt -- but it looks like Qt is now a commercial product. (Blah.) How about GTK+? I've never used it before. Is it worth learning?

    And then there's Tcl/Tk, but it seems pretty much overkill to link in all that crap just to display some buttons in a window.

    Any other solutions I'm overlooking?

    - Warren
     
  2. jcsd
  3. Dec 12, 2003 #2

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Or maybe I should just develop in Python.

    - Warren
     
  4. Dec 12, 2003 #3

    dduardo

    User Avatar
    Staff Emeritus

    If your developing non-proprietary software you can just use the Qt/X11 Free Edition. You only have to pay if you doing proprietary development or you want support.
     
  5. Dec 12, 2003 #4

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

  6. Dec 12, 2003 #5
    GTK+ is still a bit of a project. Needs more time to be developed to seriously think of using it.

    Python is a very good choice, becoming more popular of late.
     
  7. Dec 12, 2003 #6

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Eh well, Python just uses Tcl/Tk for GUIs. So I might as well just develop in C++ and link in Tk. Of course, maybe Python has some features I might like.. I'll have to look into it.

    - Warren
     
  8. Dec 15, 2003 #7
    My tupence...

    I would employ a framework that facilitates the creation of a GUI consistent with the platform in which it is deployed; in other words, a GUI in Java's Swing might be [mostly] cross-platform, but it doesn't have an native feel for most Windows users. This is of course assuming you care about the end-user experience in the first place.

    It is my opinion that something like wxWindows would be a superior choice over what you've listed so far. You get a GUI rendered with the libraries native to the platform, you get a mostly lucid framework for which to develop your application, and you get to use C++.

    Another choice if you're willing to brave the tides of Microsoft is .NET. I'm a .NET advocate, and I get the sense that this is not something you'd really want to consider; however, depending on your needs you could develop a cross-platform GUI.

    If none of the above suit your palate, I'd have to go with Java.
     
  9. Dec 15, 2003 #8

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I thought about wxWindows. I used it back in school for some really crappy programs in this one class. My final opinion of it was that it was crappy. Maybe it's not crappy anymore, but it left a bad taste in my mouth.

    And yeah, you can rest assured I wouldn't touch .NET with someone else's ten foot pole.

    - Warren
     
  10. Dec 15, 2003 #9

    dduardo

    User Avatar
    Staff Emeritus

    Talking about .Net, why don't you try Mono.
     
  11. Dec 15, 2003 #10
    I haven't actually used wxWindows in a while, but at the time it was suitable; better than the alternatives, at least.

    Have you not considered Java? You seem to dislike commercial products, and I can understand that; however, Java has been promoted from Sun's monarchical control to at least oligarchic control with the http://www.jcp.org/en/home/index. It's still not community code, but it's a step in the right direction.

    .NET really is a fantastic platform, but those opposed generally can't be persuaded. If you change your mind and have questions, I'd like to answer them.
     
  12. Dec 15, 2003 #11

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Java is absolutely my first choice in nearly all projects of this sort, and that's what I've been using so far. However, the application I'm writing has a lot of byte-wise arthmetic, and I am getting pretty annoyed at the inability to cast byte[4] to int in Java. Instead, I'm having to deal with pretty pathetic performance. And no, I don't really care to know anything about .NET. I've read enough to know what it is and what it can do, and still intend to boycott anything Microsoft does.

    - Warren
     
  13. Dec 15, 2003 #12
    Say what you will about MS, but .net is still a very strong application framework. Looked into python yet?
     
  14. Dec 16, 2003 #13

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    .NET will hopefully die the death it deserves to die. It's just not necessary.

    And I know Python fairly well already. The question is not "should I learn Python?" The question is "should I use Python?"

    - Warren
     
  15. Dec 16, 2003 #14
    I would agree .net might not be necessary for client apps, but it is a master on the web enterprise market where J2EE is it's only competition.

    btw, what is this app all about, I am intrigued now
     
  16. Dec 16, 2003 #15

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Sorry, can't tell you.

    - Warren
     
  17. Dec 16, 2003 #16
    haha booooooo! :wink:
     
  18. Dec 16, 2003 #17
    Wishful thinking 3 years ago, but there's simply no way .NET will die at this point. Its pervasiveness in the enterprise, open-source (believe it or not), and use in just about every reference architecture implementations available today ensure it a long life.

    Python is a great language, but I can't imagine that being preferred over C++ and wxWindows. Another option might be to encapsulate the more computationally expensive facets of your app in a standard C++ library; you could then still use Java for its cross-platform benefits and simply JNI to the library. Just a thought.

    Good luck with your app.
     
  19. Jan 7, 2004 #18
    what about fltk?

    There is a very easy to use and with good documentation cross-platform GUI Toolkit called The Fast Light Toolkit.
    You can find it here: http://www.fltk.org

    Here is a description copied and pasted from the link above:

    FLTK (pronounced "fulltick") is a cross-platform C++ GUI toolkit for UNIX®/Linux® (X11), Microsoft® Windows®, and MacOS® X. FLTK provides modern GUI functionality without the bloat and supports 3D graphics via OpenGL® and its built-in GLUT emulation. It is currently maintained by a small group of developers across the world with a central repository on SourceForge.

    FLTK is designed to be small and modular enough to be statically linked - the "hello" program is only 97k when compiled on an x86 Linux system! FLTK also works fine as a shared library and is now being included on Linux distributions.

    FLTK also includes an excellent UI builder called FLUID that can be used to create applications in minutes.

    FLTK is provided under the terms of the GNU Library Public License, Version 2 with exceptions that allow for static linking.

    FLTK 1.1.x is the current stable release branch. FLTK 1.2 is currently in development and available via CVS. Please see the software page for details. The first 1.2 beta releases will likely appear by the end of 2003, with a final release around the middle of 2004.

    FLTK 1.2 will provide enhanced device, rendering, and style interfaces to support more platforms, printing, and application "skins".
     
  20. Jan 7, 2004 #19

    dduardo

    User Avatar
    Staff Emeritus

    Ernest0x, FLTK looks very promising. Just skimming through the documentation, it has a wide range of tools at the programmers disposal. Unfortunetly, Qt has a much larger library, including: tables, networking, SQL and XML support. Nontheless, FLTK seems to be sutible for small to medium sized projects. This could be exactly what chroot is looking for.
     
  21. Jan 16, 2004 #20
    My suggestion is to use java and simply call C++ code through JNI. That way you won't need to perform bit ops in java, but marely delegate from from java to c++. That way, only the gui is implemented with java, not the actual logic. You could do this, for instance:

    public class MyNativeListener implements ActionListener
    {
    public native void actionPerformed(ActionEvent e);
    }

    which would then invoke native code when the component it is attached to fires an ActionEvent.

    If you want the native look and feel you use either the AWT or you can use JFC with a look and feel that looks native.

    Nille
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Cross-platform GUIs?
  1. Linux GUI (Replies: 6)

Loading...