[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

create and show Forms with NMStrmServ component

Hello,

Quite stuck with the following...

I try to create a form after a message is delivered by the NMStrmServ
component. like :

procedure TfrmServer.NMStrmServ1MSG(Sender: TComponent;
 const sFrom: String; strm: TStream);
begin
 If sFrom='Person' then  frmSelectForm.ShowForm;
end;

frmSelectForm is a form with a Tlist and every item in a list has an Object
with a Form.
(I don't put the code to select the proper Object from the list etc..)

procedure TfrmSelectForm.ShowForm;
Begin
 If MyForm=NIL Then
 Begin
   Application.CreateForm(TFormClass(TfrmCardImage), MyForm);
   MyForm.Show;

   //Also not work..
   //MyForm:=TfrmCardImage.Create(FOwner);
   //MyForm.Parent:=Application.MainForm;
  MyForm.Show;
End;

The form is not shown on the screen and when I leave the application it
gives me a win32 error.
It has something to do that the application is not creating the form in the
right way. Maybe the server component is in a Thread.
Don't bother with the list, object in the list, etc, because this works fine.

If a Visual component on the frmSelectForm, like a button, is doing the job,
the MyForm is OK and shown on screen when an user clicks on the button.

I can do this also with the NMStrmServ and calling a procedure that doing a
postmessage to the button like : PostMessage(btnPostButton.Handle,
cn_Command, bn_Clicked, 0);
In the buttonclick event of btnPostButton I create the form and everything
is OK again.

So, only when the event of the NMStrmServ is calling the create/show form
procedure the form will not show on screen. I'v tried to set the Parent,
Owner and things, but can not find the right way.

HELP!!!!!!!!

Greets,

Rob.
0
Delphi-Lover
Asked:
Delphi-Lover
  • 5
  • 3
  • 2
1 Solution
 
esoftbgCommented:
MyForm.ShowModal;

emil
0
 
esoftbgCommented:
procedure TfrmSelectForm.FormShow(Sender: TObject);
begin
 if not Assigned(MyForm) then
   Application.CreateForm(TfrmCardImage, MyForm);
  MyForm.ShowModal;
end;
0
 
Delphi-LoverAuthor Commented:
The problem is not in creating the form in an ordinary way, but the NMStrmServer component is doing something strange. I Can not do it in the Formshow of the SelectForm, because this is already open and visible. I don't want to do Showmodel, but show.

If a Visual component on the frmSelectForm, like a button, is doing the job, the MyForm is OK and shown on screen when an user clicks on the button.
It seems there must be a action from a user doing it in the frmSelectForm. It is very weird that in the event of the NMStrmServer component it goes wrong. I'm opening forms from other forms for years, but this time it doesn't work. (because of the NMStrmServer component!!) It must be some low level thing. like setting owner, parent , visible or something?

my try : Application.CreateForm(TFormClass(TfrmCardImage), MyForm);
your answer: Application.CreateForm(TfrmCardImage, MyForm);
must be the same...

Thanks.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Delphi-LoverAuthor Commented:
here a post on a newsgroup with the same problem!
http://www.elists.org/pipermail/delphi/2000-June/009167.html

but no answer ;-(
0
 
kretzschmarCommented:
maybe you need only to add

application.processmessages;

just after you use the show-method

meikl ;-)
0
 
Delphi-LoverAuthor Commented:
The ProcessMessages procedure doesn't work. The form is somehow destroyed by the server component. With the ProcessMessages you can now see a flash of the form on screen for 1 milisecond. The problem is in the way how the server component is doing his thread thing. It should work if the Indy component suite is used (There is a TCP component availble) but I like to see if the problem can be solved with the native FastNet components. (I've mailed the FastNet guys and waiting for an answer)

Can you be quicker with the solution?

Thanks,

Rob
0
 
esoftbgCommented:
Hi Delphi-Lover,

I have not solution for that bug. I am using Delphi Enterprise version 7.0 and there is not FastNet components. I can not taste it at all.

Sorry,
emil
0
 
kretzschmarCommented:
thanks for accepting my comment as answer,
but could you explain the c-grade?

meikl ;-)
0
 
Delphi-LoverAuthor Commented:
Hello,

I'm not aware of a C-Grade? I could not find a way to close this item that is open for so long time. There is no solution for this question. To close this item anyway, i decided to accept the answer of Master Kretschmar, not infecting the points thing because he has already over 1 million of them :-)))

Greets,

DL.
0
 
Delphi-LoverAuthor Commented:
Kretzschmar,

There is no solution to this question, but there is an answer. There must be a flaw in this native component and there is not much we can do about it, only using an other (Indy) component. (Maybe this is the solution:-) Maybe it is wise to leave this question so that others who are getting the same problem can at least find something about it.

Greets,

DL.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now