?
Solved

create and show Forms with NMStrmServ component

Posted on 2004-04-05
11
Medium Priority
?
176 Views
Last Modified: 2010-04-16
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
Comment
Question by:Delphi-Lover
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
11 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 10755785
MyForm.ShowModal;

emil
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10755795
procedure TfrmSelectForm.FormShow(Sender: TObject);
begin
 if not Assigned(MyForm) then
   Application.CreateForm(TfrmCardImage, MyForm);
  MyForm.ShowModal;
end;
0
 

Author Comment

by:Delphi-Lover
ID: 10756020
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

but no answer ;-(
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 10759278
maybe you need only to add

application.processmessages;

just after you use the show-method

meikl ;-)
0
 

Author Comment

by:Delphi-Lover
ID: 10763784
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
 
LVL 12

Expert Comment

by:esoftbg
ID: 10763859
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12337569
thanks for accepting my comment as answer,
but could you explain the c-grade?

meikl ;-)
0
 

Author Comment

by:Delphi-Lover
ID: 12337648
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
 

Author Comment

by:Delphi-Lover
ID: 12337933
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question