Re: C++/Tk

From: Sektor van Skijlen (ethouris_at_pl.spamu.lubie.nie.wp.invalid)
Date: 11/02/04


Date: Tue, 2 Nov 2004 17:59:08 +0000 (UTC)

Dnia Tue, 02 Nov 2004 16:23:46 +0100, Maciej Sobczak skrobie:
> Hello,

> I'm pleased to announce the first release of the C++/Tk library:

> http://cpptk.sourceforge.net/

> This library is a C++ interface to the Tk GUI toolkit and uses some
> advanced coding techniques to achieve the syntactic similarity to Tcl/Tk.

> This library may of interest to those programmers who normally use
> Tcl/Tk to write front-ends to some C or C++ code.
> Thanks to C++/Tk, this kind of integration can be realised entirely in
> C++ code.

> Constructive criticism is welcome!

Great job! That was something that came to my mind some time ago, but looking
at solutions CppTk provides it looks much better. :)

Ok, so some notes from the first look :)

1. Access to each GUI object is through the text-based name. I don't think
this is a good approach in C++. It makes also all "object methods"
global functions or something - which again makes it - I think - hadrly
extensible. It would be good to provide some method to access objects through
pointer or reference; this way you would implement object methods as normal
C++ methods (yes, I know this would require static types for widget objects).

Or you found a better method for making the widget commands extensible (for
example, when I create my own widget class and I want to make it a command
that already exists).

2. What about using function objects (functional instances) instead of pointer
to function in, for example, "command"? Regarding that you already use boost,
I think it would be also nice to use boost::bind and signal-slot mechanisms.

3. I got a feeling that for some commands () are not required. For example,
tk_chooseColor could be used without ():

string newColor(tk_chooseColor -initialcolor("blue") -parent(".")
        -title("select color"));

Here, tk_chooseColor could already be an object, for which operator "-"
accepts option objects etc.

I think it would be good also to have some additional Tcl facilities, like
splitting string into a list of words, also commands like split and join; they
would work with std::string and std::vector<std::string>.

Regards,

-- 
//  _    ___         Michal "Sektor" Malecki <sektor(whirl)kis.p.lodz.pl>
\\ L_ |/ `|  /^\ ,()                         <ethourhs(O)wp.pl>
// \_ |\  \/ \_/ /\ C++ bez cholesterolu: http://www.intercon.pl/~sektor/cbx
"Java does not have pointers!"


Relevant Pages

  • Re: [opensuse] Strange desktop setup
    ... to get the desktop to work in a manner I expect it to. ... pointer to the top edge of the screen, the taskbar slides down past the ... bottom edge of the screen and on moving the mouse pointer to the bottom ... For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx ...
    (SuSE)
  • Re: Ahve got them Function Pointer blues
    ... struct FS ... My problem is that the <function pointer> is of unknown type - in ... and producing an output file. ... The commands will be, for example ...
    (comp.lang.c)
  • Re: GUNDOG-L Digest - 22 Jul 2005 to 26 Jul 2005 (#2005-113)
    ... You should not have to teach a Pointer ... Pointing is an instinct, not a trained command. ... steps you mention below are teaching the dog to WHOA, ... Repetitive commands given too early and often, ...
    (rec.hunting.dogs)
  • Mixed Sync/Async communications pattern
    ... looking for a pointer ... Some commands do not require a response from B, and some do, but I ... Async events from B can in turn cause one or more commands from A to ...
    (comp.lang.tcl)
  • Re: Tcl/Tk - Observations from a newbie.
    ... hopefully bringing others into the Tcl/Tk fold. ... :4 - Add tree control widget ... :12- Rename tk_getOpenFile to tk_chooseFile ... :12,13,14,15 - For consistency with other related commands, these commands ...
    (comp.lang.tcl)