Posted on 2005-07-31 15:16:01-07 by xol
onCreate like calback
I need to make something like onCreate callback in my perl Tk script. In other words I want my subroutine to run when I create some widget. How can I do it? A simple binding to Create event is not working. Thank you in advance.
Alex.
Dimax U2C-11 USB to I2C/SPI/GPIO Adapter
Direct Responses: 814 | Write a response
Posted on 2005-07-31 16:43:13-07 by vkon in response to 813
Re: onCreate like calback
I can't manage syntax on this page, so please see my answer at http://www.vkonovalov.ru/cgi-bin/usemod-wiki.pl?Tcltk-Oncreate
Direct Responses: 815 | Write a response
Posted on 2005-07-31 20:14:04-07 by xol in response to 814
Re: onCreate like calback
Thanks. I'm using Tk module, not Tcl:Tk, do you think it will still work? Seams strange that such a comon and widely used feature was not implemented. Probably I'm doing something wrong? I need to initialize some resource ( let's say open a file ) and I want to notify user in case of error by message box and not by printing message. It means I have to run GUI main loop prior to poping up the message box. I though to put inititalization code in onCreate handler and be able to make some GUI communication with user if I have a problems.

Thanks.

#
# Dimax USB to I2C/SPI/GPIO Adapter
#
Direct Responses: 816 | 817 | Write a response
Posted on 2005-08-01 06:36:00-07 by vkonovalov in response to 815
Re: onCreate like calback
Tcl::Tk and Tk are different Perl modules, so you must ask elsewhere, but many questions have very same answer, as these have many in common: they provide same thing to user but have different way of embedding Tk into module. IMO Tcl::Tk is better to use due to more flexibility you get. As to your direct question, you can try asking your question Tcl people, at ActiveTcl@listserv.ActiveState.com or even better at their TCT ML
Direct Responses: Write a response
Posted on 2005-08-01 06:42:19-07 by xol in response to 815
Re: onCreate like calback
Ok. Thanks a lot. It's working with Tk::MainWindow as well.

#
#Dimax USB to I2C/SPI/GPIO Adapter
#
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.