Re: [twsocket] TWSocket.Dup() ?

2006-01-07 Thread Wilfried Mestdagh
Hello Michael,

You dont need to replicate it. Just leave the Socket where it is. In
your second form you can have a socket that points to the other socket.
Dont drop one on the second form, but just (I called the socket Cli):

SecondForm.Cli := MainForm.Cli;

and then you call all in the Cli of the second form witch points to the
Cli of the mail form.

An object variable is just a pointer to the actual object, so you can as
many pointers to the same object as you wants.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Saturday, January 7, 2006, 00:58, Michael Preslar wrote:

 I have my main form which has a TWSocket.. All is well. Now, I'd like to
 add another form (visibility can be toggled on or off .. and in truth,
 its just a little chat window)..

 I'm thinking that I need to replicate the TWSocket from the main form 
 onto the chat form, so my charform.sendbutton.onclick() can 
 chatform.socket.sendstr(inputbox.text);

 Is this the right way to go? If so, whats the better way to make this work?

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocket.Dup() ?

2006-01-07 Thread Michael Preslar
What I ended up doing (Which I'll spit out here just in case anyone else 
ever runs into the same situation .. Or maybe theres a better way):

First define 2 variables..

chatform.socket : pointer;
chatform.connected : boolean;

Then set the chatform variables

mainform.ConnectToServerClick()

   if not assigned(chatform.socket) then
 chatform.socket := @WSocket1;

mainform.WSocket1.OnSessionConnected()

   chatform.connected := true;


mainform.WSocket1.OnSessionClosed()

   chatform.connected := false;

Then, finally, in the chatform, when the user does something and needs 
to send data..

if assigned(socket) and connected then
   TWSocket(socket).sendstr(s);

Haven't stress tested it or anything yet, but it works well in my 
testing so far.

Wilfried Mestdagh wrote:
 Hello Michael,
 
 You dont need to replicate it. Just leave the Socket where it is. In
 your second form you can have a socket that points to the other socket.
 Dont drop one on the second form, but just (I called the socket Cli):
 
 SecondForm.Cli := MainForm.Cli;
 
 and then you call all in the Cli of the second form witch points to the
 Cli of the mail form.
 
 An object variable is just a pointer to the actual object, so you can as
 many pointers to the same object as you wants.
 
 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz
...
 Is this the right way to go? If so, whats the better way to make this work?

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be