Gui Library Suggestion

Pages: 123
hey Disch thanks.. it looks good now.. just have to include a .rc file in code::blocks.
closed account (z05DSL3A)
computerquip wrote:
Cross platform libraries almost never cripple your UI and sometimes even help to make more complicated GUIs simple. wxWidgets is a good example of this and as it is open source, any functionality you find is lacking, you can easily add it yourself and then reuse it through out your program. The reason to code directly with WinAPI is to remove any overhead given from the extra functionality provided by the library. I'd like to see you try and code something directly with X11. Good luck with that, creating a window is complex enough for at least four "Bang head on wall here" posters.


I think I forgot a word should have been be:

"At best you will add a level of abstraction that to have the same functionality but more likely you will have less functionality available and end up crippling your UI design."

meaning that I will not function as you want it to.

You can, as computerquip said, add the functionality yourself; but that would require you to learn the internal workings of the your chosen library and design your extension so as not to work against it. You would also need to have an understanding of the native APIs involved to wrap them into your code.

Don't get me wrong, I'm not against Cross platform libraries. I just don't allways see them as a time saver (plus when I asked about native API, there was not specific indication that cross platform was an issue).

hey thanks everyone. here's my plan, tell me what you think about it.
1. learn the basics of winAPI
2. learn wxWidgets

lately i've been using wxWidgets. so far so good, also there are tools available in making wxWidgets GUI visually (i tried a few already) though i prefer manually coding it.

also another thing that i consider is this
wxWidgets wrote:
Unlike other cross-platform toolkits, wxWidgets gives its applications a truly native look and feel because it uses the platform's native API rather than emulating the GUI.
The "basics" of WinAPI aren't so basic because they involve a lot of archaic procedures. To create a window is multiple seemingly unrelated steps. (I'm still not entirely sure what registering the window class does, nor why it needs to be different from actually creating the Window).

Plus WinAPI isn't very OOP friendly at all. Event handlers have to be global functions, and for most messages there's no way to get pass a user pointer passed (that I've found).

wx changes a lot of stuff too. And the stuff that is similar can be just as easily (or more easily) learned via wx than via WinAPI.

IMO I say just skip WinAPI... unless WinAPI coding is a specific goal. If you're using WinAPI as a stepping stone to learning wx, don't bother.
Last edited on
I'm still not entirely sure what registering the window class does
i also have that in mind.

Plus WinAPI isn't very OOP friendly at all.
Grey Wolf said WinAPI is written in C not C++

i guess i'll skip WinAPI for now.. and yeah wx is very n00b friendly

I'm still not entirely sure what registering the window class does, nor why it needs to be different from actually creating the Window


Because some classes from which actual instances of windows can be instantiated are system classes, i.e., edit controls (text boxes), listboxes, buttons, etc., and others are custom user defined classes of which the system is unaware until they are registered at run time by the program.

For example, say I'm building a grid custom control of my own and intend to house it in a dll. When the dll is loaded either implicitely or explicitely it will receive a DLL_PROCESS_ATTACH message from the OS. At that time in a message handler I might fill out a WNDCLASSEX struct where the class name "MyGrid" is specified, as well as all other general charactistics of the "MyGrid" class, including the address of the Window Procedure to be called for every instance of the grid created. I then register the class, i.e., tell Windows about it, so that if it sees "MyGrid" in a CreateWindow() call, it knows what to do. The host app can then create an actual instance of the "MyGrid" class in the Dll through a CreateWindow() call specifying actual screen locations, sizes, etc.

The general architecture is such that every window is a member of either a 'system' class, or one created by the user. And the beuuty of it is that only two functions are involved, i.e., RegistewrClassEx() and CreateWindowEx(). The former is the cookie cutter, and the latter is the cookie.

There are other ways to go about it. GTK+ in Linux does something like this if you want to create a button...

GTK_WINDOW_CREATE_BUTTON(.....)

or an edit control....

GTK_WINDOW_CREATE_EDIT_CONTROL(....)

or a label....

GTK_WINDOW_CREATE_LABEL(....)

etc.

Get the picture? Is this workable? Yes. Is it practical? Yes. Is it elegant? NOOOOOOOOO!
Its as ugly as sin!

With Windows, through the generalized architecture of generalized Window Classes from which specific instances of Windows are created through CreateWindow calls you have an OOP system which encompasses every window in the whole operating system from the lowliest label to the most complicated ActiveX control. And all created at some level through this dual call setup.


...and for most messages there's no way to get pass a user pointer passed (that I've found).


Could you elaborate please. I don't understand what you are saying. I think a typo or something...




tl;dr XD

Sorry. I would bother reading if I cared about working with WinAPI anymore. But since I don't plan to ever again....

I'll concede that it most likely makes perfect sense and I just never took the time to fully understand it.

Could you elaborate please. I don't understand what you are saying. I think a typo or something...


Yeah I think I did typo that.

There's probably a way to do this that I never figured out, either. Basically I always wanted you to be able to have a user-defined pointer get passed to your WNDPROC with messages (like how you get a void* with most callback systems). This way you can easily set up an OOP design.

The problem is.. there is no such parameter passed to WNDPROC. Closest you get is the HWND. Now there might be a way to get a void pointer from an HWND -- but that's what I never figured out.

Bear in mind it's been a long while since I've done any of this.
closed account (S6k9GNh0)
Wait, wait.... GTK+ was not originally made for ease of use, it was made for the GIMP GUI and ended up being one of the few libraries that could work with X11. It was ported to Win32 to allow porting of the application as well. GTK+ is NOT a good example of a cross-platform library although usable. It's an extremely ugly library with acne and a humped-back.

If you want elegance, look at the libraries that were meant all applications, not just one that ended up working for any application that wanted to use it. wxWidgets and Qt are both great competitors and I can easily recommend them over GTK+.

Xorg's library is terribly designed and extremely difficult to work with. If you look at some of the GTK+ internal source, you'll find the implementation horrific but it's mainly due to Xorg's external library. A lot of people argue that Xorg is possibly the worst designed software known to man.
Last edited on
closed account (S6k9GNh0)
I'm telling ya, someone should just stop, create a new design and re-implement. Xorg is not one of the better ends of Linux. As long as all of the libraries that everything is dependent on makes an implementation to the new design, there would be virtually no harm done.
hey wxWidgets users.. please answer this post i have in wxWidget forum.. the forum there seems to be inactive.

http://wxforum.shadonet.com/viewtopic.php?t=26930
I'd help if I could, blackcoder. =(

I'm stuck on Ubuntu these days. Sorry =(
yes you could help me.. i also need help with moving to ubuntu.. i dual booted my pc with ubuntu to test wxwidgets. but i'm confuse with linux.

here are the things i want to know..
-does ubuntu use registry? if not what does it use then? i've read it does not.
-does it use environment variables?
-compilers? i've read there's already one in ubuntu, where is it?
-how does ubuntu recognize installed programs if it does not use registry?
-what are executable files in ubuntu? i've read every file could be an executable.
-i wan to understand the terminal (cmd.exe in windows)

basically i want to understand how ubuntu linux works. for me to develop programs with ease and comfort.

-thanks Disch
You really need to go to the Ubuntu Forums for these questions. However....


does ubuntu use registry? if not what does it use then? i've read it does not.


Absolutely not. Everything a program needs is either stored in the directory with it, or system directories in its PATH.


does it use environment variables?


Absolutely. Just do a search on environment variables and you'll come up with many listings on how both Linux and Windows uses them. I think Wikipedia has a good piece.


compilers? i've read there's already one in ubuntu, where is it?


Yes, last I checked, parts of the GNU collection were installed, but not the headers for development. To do any developmeny you need to install the build-essential package. If you want to fool around with X you need the X development headers and such; I forget the name - X Org meta-package or something like that.


how does ubuntu recognize installed programs if it does not use registry?


??? You can create shortcuts to executable binaries - just like in Windows.


i wan to understand the terminal (cmd.exe in windows)


There are piles of tutorials on that in the Ubuntu documentation.



Hoooo, I am so the wrong guy to answer Linux questions.

1) I'm pretty sure it doesn't. I think programs just use config files instead.

2) I have no idea

3) Install the build-essentials package (at least I think that's what it's called). You can get it through Synaptic or you can use apt-get if you're a commandline masochist.

I use the Code::Blocks IDE, which you can also get through Synaptic / apt-get.

4) I don't think it does. It recognizes installed "packages" (which are not necessarily all programs), but I have no idea how it keeps track of that internally.

5) I don't think there's a way to tell whether or not a file is an executable by looking at its extension (like you can on Windows). From what I've seen, executables don't have extensions, but I've also seen files with no extension that aren't executables.

Other programs are able to tell somehow, though. I wonder if they're actually opening the file and looking for a binary header/signature or something. That seems absurd, but I wouldn't count it out.

6) I'm so the wrong guy to ask. I avoid the terminal at all costs.


In case you didn't notice, I'm not a Linux fan. I tried it out because my friends hyped it up. BIG mistake. I'm switching back to Windows as soon as I upgrade my comp. I'll only switch back for testing my programs on different platforms.


EDIT: yay someone else replied to you. They're probably more helpful than I could be. heh.

Thanks freddie.
Last edited on
thanks Disch and freddie1.

i'm reading about ubuntu, but the informations im getting are not so straight forward.. most authors talk much about how good linux is and how crap windows is.. gosh, how about programming an OS by themselves, IMO windows is popular that's why virus programmers target this platform.
closed account (S6k9GNh0)
Well, I will admit that Windows has its +1s. It gets stronger as time passes by but it still has flaws over Windows. Linux has flaws as well, don't get me wrong but for security, resource management, and a few other reasons, Linux is the way to go. If I ever have a small game server, web server, or I want high security on a server which allows users to have there own directories of anonymous storage, I will almost always go Linux.

Also:

@Linux with registry: Registry is the worst idea in the world and should be banished. It's just a large hole of slow key storage.

@Only on compiler in Ubuntu: Most common Linux-based distros now adays come with GNU GCC and for the most part, G++. Even if they do not, it is extremely easy to get all of the above working just fine through package manager or source and manual configuration.

You can also install any compiler you want outside of Borland and VC++ since they're both Win32/64 based.

@Linux terminal: It's still called console or command prompt. It's also a bit more defined than in Windows and a lot less forgiving which means the wrong command equals an unstable operating system. I actually always have a command prompt sitting on my desktop. It has tabbing, a neat transparent background of a picture that is completely wicked, and a font that is just right.


The main reason for Linux: Freedom. You can do anything you want in Linux.
Last edited on
I usually set up my computers as dual boot Windows/Linux setups. What has really gotten popular the last year or two are virtual machines one way or the other, i.e., Windows running as a virtual machine in Linux, or vice-versa.

I just never seem to get time to play with Linux but I do like it. My big deal is small tight code and Linux seems to even beat Windows at that. If I recall correctly, I can compile a straight X program in C++ that includes my own string class that itself has about five-six hundred lines of code, and the resulting executable is only 6-7 K.

That was news to me that GTK+ is now 'out of favor'. About a year or two ago I got a fresh published book on it by Andy something or other, and started working on it, but had to put it down and never got back to it. The GTK+ though produced small, tight executables; the syntax was ugly though as I mentioned.

Now I see though that wxWidgets is in favor. Everywhere you turn I hear about wxWidgets. Next year perhaps something else, but right now wxWidgets is the thing!

I had briefly looked at wxWidgets when I was trying to discover some GUI creating library for Linux, and I downloaded a demo and ran it. I recall a little program with a window and a few controls, and the executable was 800K or something like that. I basically rejected it on those grounds coupled with the fact that the syntax didn't appeal to me either. I won't consider using anything where you need more than 20K to produce a hello, world program, and that goes for Linux or Windows, GUI or console.

Say Disch, if you are still following this thread, I could answer that thing about pointers you raised, but I don't want to seem like I'm hijacking the thread, and I don't know that you are all that interested in the Win Api anyway from what you said. If you want an explanation though I'll try.

Last edited on
closed account (S6k9GNh0)
It's not that GTK+ is out of favor. It's a reliable library and it gets the job done in C. But it's not pretty. If you've ever looked at the function names, you'll find yourself typing more function names than some of your own personal algorithms and logic. Not to mention that it's completely messy in design although I don't think the design in this case affects the performance or external look.

I use GTK+ myself but usually though Glade or something that uses it as a backend while I use a frontend. I cannot STAND to interact with GTK+ directly.
Just to clear up a few things regarding:

-does ubuntu use registry? if not what does it use then? i've read it does not.
-does it use environment variables?
-compilers? i've read there's already one in ubuntu, where is it?
-how does ubuntu recognize installed programs if it does not use registry?
-what are executable files in ubuntu? i've read every file could be an executable.
-i wan to understand the terminal (cmd.exe in windows)


1. Ubuntu is a specific distribution of Linux. Linux does not have a centralized, hierarchial configuration database like the Windows Registry. The filesystem itself is hierarchial, with a single root, /, and is [traditionally?] organized in a very specific manor.

/ is the root
/boot contains the boot loader
/dev contains device files, which can be thought of as pointers to device drivers
/proc is a virtual filesystem that displays process information
/var contains frequently-changing files
/tmp contains temporary files
/etc contains configuration files
/sbin and /bin contain programs
/usr (for Unix System Resources) contains other installations, which could include programs
/home contains subdirectories for each user to store files in, similar to My Documents in Windows
...and so on

2. GNU Compiler Collection (GCC) is the most common.

3. No OS just decides to run programs without being instructed to do so. For example, in Linux, /etc/profile.d is a directory where scripts will be run upon logon for any user. Similar to a Startup folder in Windows.

4. Executable is a permission in Linux. Program files are often binary and executable. Other files can also be 'flagged' as executable, like a DOS/Windows batch (.bat) file, or as scripts. Scripts in Linux are just text files but often times they begin with a Shebang (#!) line that tells the shell what program should interpret the script.

The file command can be used to get more information about a particular file, for example:
> file that.sh
that.sh: ASCII text
> file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9,
dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
> 


5. In Linux, the program that provides the Command Line Interface (CLI) is called a shell. There are a number of popular shells, Bash, C-Shell, etc. There is a huge overlap on the features that the various shells provide but there are significant differences between their scripting syntax/capability.

Here are some commands to look up in order to get started: ls, cp, mv, rm, mkdir, rmdir, cat, grep, man

Cheers!
Last edited on
Pages: 123