GTK on Windows
GTK on Windows
Hello, I recently was tinkering with GTK2 on Windows (runtimes needed). I think it's nice to use it as it allows 1:1 port of GUI through all platforms. So if you are developing cross-platform software you wouldn't be afraid of using API for making GUI more advanced anymore, as GTK API is the same on all platforms. Of course as long as required runtimes are not a problem (it's only about 6 MiB).
To PB Team: is there chance of getting the PB GUI library (windows & gadgets) from Linux made on GTK, but compiled for use on Windows with runtimes? Of course only as option for coders who want to use it.
If you would like to try GTK on Win32, you should get runtimes:
http://gtk-win.sourceforge.net/home/ind ... /Downloads
And a package for PureBasic:
http://drkaczka.ovh.org/pbgtk.zip
It contains libraries made with DLL Importer (only some of functions imported, quite far from being finished), gtk.res (PB resident from Linux, contains structures and constants) and few examples. I also included fixed DLL Importer as the one with PB4.31 is bugged.
To PB Team: is there chance of getting the PB GUI library (windows & gadgets) from Linux made on GTK, but compiled for use on Windows with runtimes? Of course only as option for coders who want to use it.
If you would like to try GTK on Win32, you should get runtimes:
http://gtk-win.sourceforge.net/home/ind ... /Downloads
And a package for PureBasic:
http://drkaczka.ovh.org/pbgtk.zip
It contains libraries made with DLL Importer (only some of functions imported, quite far from being finished), gtk.res (PB resident from Linux, contains structures and constants) and few examples. I also included fixed DLL Importer as the one with PB4.31 is bugged.

Re: GTK on Windows
I was wrong - GTK is using CDECL instead of StdCall, so DLL Importer can't be used for this.
Now I did it with ImportC...EndImport and imported functions from .lib libraries that are made for the runtimes and it's all working great.
Link: http://drkaczka.ovh.org/gtk2pb.zip

I spent hundreds of hours tinkering with my controls on Windows (backgrounds, ownerdrawn & colored gadgets, editable listviews etc etc) just to realize it's all useless when I needed my app on Linux (it's still long way for WINE btw). Now I'm going to learn GTK API and start making nice cross-platform GUI with it
The last thing that I need is to know is what to do with functions that has variable number of arguments?
Any ideas about this? Thanks in advance.
Now I did it with ImportC...EndImport and imported functions from .lib libraries that are made for the runtimes and it's all working great.
Link: http://drkaczka.ovh.org/gtk2pb.zip

I spent hundreds of hours tinkering with my controls on Windows (backgrounds, ownerdrawn & colored gadgets, editable listviews etc etc) just to realize it's all useless when I needed my app on Linux (it's still long way for WINE btw). Now I'm going to learn GTK API and start making nice cross-platform GUI with it

The last thing that I need is to know is what to do with functions that has variable number of arguments?
Any ideas about this? Thanks in advance.

- flaith
- Enthusiast
- Posts: 704
- Joined: Mon Apr 25, 2005 9:28 pm
- Location: $300:20 58 FC 60 - Rennes
- Contact:
Re: GTK on Windows
i have tested it, good work
, thanks for sharing

“Fear is a reaction. Courage is a decision.” - WC
Re: GTK on Windows
The problem with using GTK on Windows is that the runtime is huge (about 8mb, I think). I think the correct way to go about it would be to use the Win32 API on Windows and GTK on Linux.
I'm writing my own UI library in C++ and this is how I'm doing it. It's simpler and is guaranteed to support the most features.
I'm writing my own UI library in C++ and this is how I'm doing it. It's simpler and is guaranteed to support the most features.
Re: GTK on Windows
Are you serious, it's simpler... ? So in fact you must develop two separate libraries as GTK is totally different from WinAPI. BTW it's EXACLY the same method PureBasic Team is using. And when a trivial thing like sorting a ListIconGadget kicks in, you need to use API and do this differently for each platform. Very comfortable... Oh! and you must WATCH OUT not to MESS UP the PB INTERNALS!Mistrel wrote:The problem with using GTK on Windows is that the runtime is huge (about 8mb, I think). I think the correct way to go about it would be to use the Win32 API on Windows and GTK on Linux.
I'm writing my own UI library in C++ and this is how I'm doing it. It's simpler and is guaranteed to support the most features.
And the runtimes... I mentioned that shouldn't be problem for someone who wants to use GTK. Is 6,5 MiB really a big deal compared to .NET Framework and Java Virtual Machine?
* .NET Framework 1.0: 19.7 MiB
* .NET Framework 1.1: 23.1 MiB
* .NET Framework 2.0: 22.4 MiB
* .NET Framework 3.0: 50.3 MiB (x86)
* .NET Framework 3.0: 90.1 MiB (x64)
* .NET Framework 3.5: 197.0 MiB
I don't think so. Thanks, I still prefer the INCORRECT way.

Re: GTK on Windows
Actually it's the way PB does things. And some other toolkit as well (wxwidget for example).Mistrel wrote:The problem with using GTK on Windows is that the runtime is huge (about 8mb, I think). I think the correct way to go about it would be to use the Win32 API on Windows and GTK on Linux.
I'm writing my own UI library in C++ and this is how I'm doing it. It's simpler and is guaranteed to support the most features.
Re: GTK on Windows
simply add a -1 to the argumentsklaver wrote:The last thing that I need is to know is what to do with functions that has variable number of arguments?
Any ideas about this? Thanks in advance.

Re: GTK on Windows
But how to import such function with ImportC...EndImport?walker wrote:simply add a -1 to the arguments(this is how it works on Linux)
And how to use such functions on Linux as compiler gives error - wrong number of parameters?
And the argument list is sometimes teminated with 0 and sometimes with -1, depends of function.

Re: GTK on Windows
The link for http://drkaczka.ovh.org/pbgtk.zip no longer works.
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
Re: GTK on Windows
DuH! OK, the blindness was only temporary 
Thanks Klaver

Thanks Klaver

The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
Re: GTK on Windows
I have actually done this done this, thank you so much for the nice tips and advice now I know how GTK is using CDECL instead of StdCall.
_________________
pacquiao vs clottey live | Hits Tech Gadgets | Rapid Blog Share | Shop Market-Market
_________________
pacquiao vs clottey live | Hits Tech Gadgets | Rapid Blog Share | Shop Market-Market
-
- New User
- Posts: 3
- Joined: Tue Apr 06, 2010 4:01 am
Re: GTK on Windows
Nice tips , but is it work in windows 7 ? I am asking because i want to reboot my system , i don't want to take any risk .