Re: Adding new ItemType to Canvas
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Adding new ItemType to Canvas

From: Uwe Klein <uwe_klein_habertwedt@t-online.de>
Date: Sun Sep 18 2005 - 09:58:20 CEST

Jingzhao Ou wrote:
> Dear all,
>
> I want to add a new ItemType to the Canvas widget. The implemenation
> will be in C and hopefully be able to work crossplatform.
>
> I checked out the source code of Tk. It seems that this is possible
> using "Tk_CreateItemType(typePtr)". The source code recommends to check
> out the implemenation of the built-in types on how to create new
> ItemType.
>
> Then, I look at "TkCanvLine.c". I copied this file into a new directory
> and then changed "line" to "myline" in the new file to see if things
> can work. (see the following snippet)
>
> =============================================================
> Tk_ItemType tkLineType = {
> "myline", /* name */
> sizeof(LineItem), /* itemSize */
> CreateLine, /* createProc */
> configSpecs, /* configSpecs */
> =============================================================
>
> However, to compile the file, the following header files are required:
>
> #include "tkInt.h"
> #include "tkPort.h"
> #include "tkCanvas.h"
>
> I am trying to get the new C file work with ActiveTcl. (1) The
> "include" directory of ActiveTcl only provide "tkInt.h". (2)
> "tkCancas.h" is simple and can be copied from the source.
>
> (3) My current problem is how to deal with "tkPort.h"? It is not
> included in the ActiveTcl distribution and requires quite some other
> files in the Tk source.
>
> Can any one kindly give me some suggestions on how to resolve the above
> issues?
>
> Thanks a lot!
>
> Best regards,
> Jingzhao
>
Hi,
i have it in :

...../tk${version}/generic/tkPort.h

and (post install) in :

/usr/include/tkPort.h

if it is still missing look here:
ftp://www.tcl.tk/pub/tcl/nightly-cvs/
get tk-20050913.tar.gz or newer
it contains :
-rw-r--r-- andreask/users 2981 2002-10-19 08:06:50 tk/win/tkWinPort.h
-rw-r--r-- andreask/users 5163 2003-10-19 08:03:46 tk/unix/tkUnixPort.h
-rw-r--r-- andreask/users 733 2004-04-25 08:04:06 tk/generic/tkPort.h
-rw-r--r-- andreask/users 4983 2004-01-13 08:04:36 tk/macosx/tkMacOSXPort.h

uwe
Received on Thu Sep 29 14:37:31 2005