Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple forms using a single procedure
#6
(12-30-2020, 10:26 PM)davidbaxter Wrote: Is it possible to have have a two form application and be able to call a procedure in form1 from form2? I have a web socket on form1 and I'd like to have one "sendMsg(string);" on form1 that form2 would call. Standard practice in Delphi itself, but the Intraweb app doesn't seem to let me. Do I need another socket on form2 to have it communicate? I have the units in the 'uses' clause of each other and I can see form1 variables in form2 but not procedures.

Don't use sockets like that in an IW application.

Each session (i.e. each connected user) will have a different instance of Form1 and Form2. In that case you would end up with multiple sockets instances probably trying to use the same port. Other than that it would create a huge overhead...

The best thing to do is: refactor your code, move whatever code you want to share to a separate unit (preferably a class). And then you can call the method from any form.
Reply


Messages In This Thread
RE: Multiple forms using a single procedure - by Alexandre Machado - 01-06-2021, 09:49 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)