gettingstarted
[Top] [All Lists]

How to call a method in a window from a TCPSocket

To: gettingstarted at lists dot realsoftware dot com
Subject: How to call a method in a window from a TCPSocket
From: jdossey at att dot net
Date: Thu, 31 Mar 2005 17:47:58 +0000
Delivered-to: gettingstarted at lists dot realsoftware dot com
I have a subclass of TCPSocket that I call MyTCPSocket.  In MyTCPSocket I have 
some code in the Connected, DataAvailable, and Error Events.  In DataAvailable 
I want to format the data received, and then pass that formatted data to 
another method which is in the main window.  And, I might have more than one 
copy of the main window open, and each one has it's own copy of MyTCPSocket - 
which I dragged to the main window in the IDE.  The copy of MyTCPSocket in each 
window is called MyTCPSocket1.  How do I call a method that is in the window 
from MyTCPSocket1?  I've tried using "self.ProcessIt", but I get a "this method 
or property doesn't exist" error message.  I could call ProcessIt using the 
window name like this "Window1.ProcessIt", but will it call the ProcessIt 
method for the correct window if I have multiple copies of Window1 open at the 
same time?

I know that I can copy the Event handler code from MyTCPSocket to MyTCPSocket1, 
but then I have to copy that same code to every different type of window that I 
create that uses MyTCPSocket.  That's what I'm doing now.  I'd like to just 
keep the code in MyTCPSocket.

--
Jim Dossey
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>