callbacks into newlisp?

Started by starseed, July 29, 2006, 03:12:48 PM

Previous topic - Next topic

starseed

Hi,



I'm toying around with newlisp, and am trying to use IUP [1] for gui creation.

I have been able to show something (hooray! ;-), and the interesting part will be to add callbacks to buttons, etc.



How does newlisp-tk handle this? I guess there's a function added to the tk side of things?



I have skimmed through the sources, but haven't been able to find the right place to look at. I'm not too fluent in C, and not at all in tk, this may be part of it ...





If you some pointers to enlighten me, it will be highly appreciated.





Kind regards,



Ingo





[1] http://www.tecgraf.puc-rio.br/iup/">http://www.tecgraf.puc-rio.br/iup/

HPW

#1
QuoteHow does newlisp-tk handle this? I guess there's a function added to the tk side of things?


Get the source and take a look at ....newlispnewlisp-8.9.1newlisp-tknewlisp-tk.tcl. There is a '(tk   ....)' which is used to call TCL/TK from newLISP. Communication is via the TCP/IP protocol. You can also take a look at the demo-sources.



But you may also consider to use newLISP.dll, which is easily embedded in different enviroments. One advantage is that you only have one visible main-process.
Hans-Peter

Lutz

#2
Look also at this program:



http://newlisp.org/index.cgi?page=Tk_and_newLISP">http://newlisp.org/index.cgi?page=Tk_and_newLISP



with this and the newLISP executable alone (no newlisp-tk required) you can run the demos included. It makes you understand how newLISP and Tcl/Tk communicate via 2 channels.



Lutz

starseed

#3
Well, I would really like to use the dll directly, but then I need away to call back into newlisp.



I've tried to use a changed dll, but:

- host newlisp has access to the dll newlisp env, and dll newlisp C-callbacks

- iup has access to the dll environment (newlispEvalStr), and the added C-callbacks

- BUT the dll newlisp does not have access to it's own C-Functions, which I need ...



I feel like biting into my own tail ... ;-)

Lutz

#4
Use two pipes to communicate with another application, one for newLISP to listen, the other one for the other process to listen. This way you can simulate callbacks.



The newLISP-tk application works in a similar way with 2 TCP/IP channels and http://www.gtk-server.org/">http://www.gtk-server.org/ does both TCP/IP and pipes.



There are some examples for this in the description for the function 'process' in the manual.



Lutz

Lutz

#5
... and perhaps you could use signal handlers in newLISP as a call back mechanism.



Lutz