Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Jun 27, 2017 5:34 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Controlling Sessions from other sessions
PostPosted: Wed May 22, 2013 3:16 pm 
Offline
User avatar

Joined: Mon Nov 29, 2010 7:01 pm
Posts: 446
So i created a method in the App class
Sub MessageSession(s as session, msg as String)
try
s.MsgBox(msg)
catch
end
End Sub

And calling it works great!

But now I want to create method that pops up a chat window on the session you want to message, but even though I pass the proper session and I even set the session context, the chat window always appears in the current session and not the session that I pass.

Sub addChat(s as session, wdc as WDChat)
try
dim context as new WebSessionContext(s)
Dim wd as new WDChat
wdc.respondingChats.Append(wd)
wd.respondingChats = wdc.respondingChats
wd.Show
Catch
End
End Sub


The problem is that the App.AddChat is being called by session A so when I create and show the new chat window it appears in session A, but I need it to show up in the session B (the one I pass as a parameter). But even setting the webSessionContext does not fix this. I though that any method running on the App class or threads would have a Nil session that I could set with WebSessionContect, but this does not appear to be the case.

Is this possible? Am I doing something wrong? Is this a bug?


Top
 Profile  
Reply with quote  
 Post subject: Re: Controlling Sessions from other sessions
PostPosted: Mon May 27, 2013 7:17 pm 
Offline

Joined: Sun Jun 15, 2008 1:50 am
Posts: 122
neonash7777 wrote:
So i created a method in the App class
Sub MessageSession(s as session, msg as String)
try
s.MsgBox(msg)
catch
end
End Sub

And calling it works great!

But now I want to create method that pops up a chat window on the session you want to message, but even though I pass the proper session and I even set the session context, the chat window always appears in the current session and not the session that I pass.

Sub addChat(s as session, wdc as WDChat)
try
dim context as new WebSessionContext(s)
Dim wd as new WDChat
wdc.respondingChats.Append(wd)
wd.respondingChats = wdc.respondingChats
wd.Show
Catch
End
End Sub


The problem is that the App.AddChat is being called by session A so when I create and show the new chat window it appears in session A, but I need it to show up in the session B (the one I pass as a parameter). But even setting the webSessionContext does not fix this. I though that any method running on the App class or threads would have a Nil session that I could set with WebSessionContect, but this does not appear to be the case.

Is this possible? Am I doing something wrong? Is this a bug?


Someone correct me if I'm wrong but don't you have to use the session you're trying to send the message to?

I.E.
In my code
for i as integer = 0 to app.sessioncount - 1
dim s as session = app.sessionAtIndex(i)
if s.MainPanel.ListBox1 <> Nil Then
s.MainPanel.ListBox1.DeleteAllRows()
end
next


I iterate all sessions then define the session into the variable "s" and reference the control in that session (s.MainPanel.ListBox1).

Even in code where I pass the current session to an outside thread
Dim Context As New WebSessionContext(s)
s.MainPanel.ContactImport.Status.Text = "Processing " + str(QueriesProcessed) + " / " + str(TotalQueries) + " Batches of 1,000"


I still reference the session directly, even while using/creating the new WebSessionContext.

In your MessageSession function you seem to reference it that way, but in the addchat you do it to the local session instead of the remote session you're referencing.


Sub addChat(s as session, wdc as WDChat)
try
dim context as new WebSessionContext(s)
//Dim wd as new WDChat - Assign this variable name statically some where, I dunno how to spawn new things in outside sessions
s.wd = New WDChat
s.wdc.respondingChats.Append(s.wd)
s.wd.respondingChats = s.wdc.respondingChats
s.wd.Show
Catch
End
End Sub


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group