Solved

create and show Forms with NMStrmServ component

Posted on 2004-04-05
11
158 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
  • 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
 

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 50 total points
ID: 10759278
maybe you need only to add

application.processmessages;

just after you use the show-method

meikl ;-)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now