Using TK GUI in FB?
Using TK GUI in FB?
Is it posibile?
Re: Using TK GUI in FB?
Yes, it is possible. If with TK you mean TK as in Tcl/Tk then the answer to your question is 'yes'.birosys wrote:Is it posibile?
How to use FreeBASIC with TK? You first need to convert the Tcl/Tk header files to FreeBASIC yourself (they come with tcl/tk if you download it from the ActiveState site) or use SWIG to do it for you. Since the header files contain quite a lot of macros and SWIG does not translate them? you'll have to be able to translate C source to get a proper translation of the header files.
Even without the proper header files executing a Tcl/Tk script will not be that big of a problem. It's the callbacks and the rest of the communication between Tcl/Tk and FreeBASIC that will be a problem (you need the translated header files for that).
You can find an explanation of using TK in C (which is almost the same as using TK in FB/Windows) here:
http://www.linuxjournal.com/files/linux ... 344l1.html
These four lines from the above article:
- Initialize Tcl and Tk.
- Create the Tcl commands responsible for calling your C routines.
- Ask Tcl to evaluate an “interface description” file.
- Let Tk control the main flow of the program.
explain how to use TK in FB. The words "C routines" need to be changed to "FB routines" but apart from that the four lines describe the proces of using TK pretty well.
Just look at the given example program (given in the article) to get an idea of how embedding TK in C (=almost the same as embedding Tk in FB) works.
For that, first the language needs to be complete. TV, either base on the C++ or the Pascal version need inheritance.DoReMi wrote:No, I'll hope to see TurboVision analog for FB. TV is 90's project, but we still have nothing like this.
There are three or four candidates that could be ported then:
- The sf.net C++ version, but it is GPL (a GPL library)
- An older C++ TV version (BSD), I believe it's home is http://www.sigala.it/sergio/tvision/
- The C++ version as released by Borland (PD) Unfortunately after all the mergers of Borland, the FTP server it was on is dead.
- LGPL-with-mod FPC Pascal one, which is afaik actually backported from the PD C++ in the late nineties too. It misses the colorsel unit.
I would rule out the SF.NET version (as used by RHIDE) on license grounds (GPL is too strict for a lib if you can avoid it), and the Borland seems to have disappeared of the web. (but asking around might get you sources, since it is PD, but probably has 16-bits ananchronisms)
So that leaves the Sigala or the FPC version, which are essentially the same, except that the C++ version uses a bit more funky language features like operator overloading etc.
I'd say go for the C++ version if you plan to do the conversion manually (since C++ is closer to the FB spirit), but if you want to do an automated approach, the macro-less Pascal source is probably easier to parse/build a converter for.
If you want to go much lighter weight than turbo vision and have some semblence of a text gui, maybe ncurses is the way to go.
As for guis in general, I think tk is probably not the best. If you're serious, then wx or gtk are the way to go. They aren't that difficult to use either. The GTK bindings for FB are pretty good too and easy to use (just follow the api docs on gtk.org).
As for guis in general, I think tk is probably not the best. If you're serious, then wx or gtk are the way to go. They aren't that difficult to use either. The GTK bindings for FB are pretty good too and easy to use (just follow the api docs on gtk.org).
I still keep TUIs around because they are simple and easily usable remote. Just start a putty and bang away. While X is also remotely usable, it requires more than just a putty on a memstickcaseih wrote:If you want to go much lighter weight than turbo vision and have some semblence of a text gui, maybe ncurses is the way to go.
As for guis in general, I think tk is probably not the best. If you're serious, then wx or gtk are the way to go. They aren't that difficult to use either. The GTK bindings for FB are pretty good too and easy to use (just follow the api docs on gtk.org).