Solved

Want a toolbar status window for a modal application...

Posted on 2001-06-08
7
145 Views
Last Modified: 2010-04-06
I need my application to have a "Machine status" tool window so the machine can be controlled using the tool window.

The problem is that this part of the application uses modal windows and I need the tool window to be accessable from any of the windows.

"TestForm" modal window
     \ test type 1 modal window
     \ test type 2 modal window

What I've found so far is that if I create the form and have it owned by TestForm, the "child" modal forms don't allow you to press buttons on the tool window.  What I did so far is that when I display a new "test type" form, I recreate the tool window and make it owned by the "test type".

I think I'm going about this the wrong way.  Here's what I've tried:

FormCreate:  Not really suitable for various reasons but if I use it anyhow, I can't access the window (it's as though it's owned by another form).

FormShow:  If it's put here, I get some pretty ugly flickering when the form loads.  LockWindowUpdate didn't help.

FormResize:  Definitely not a good idea to put it here; sometimes get access violations even though I'm always checking to ensure the form is there first.  Always setting to nil immediatly upon Free.

How can I share this window without recreating it all the time?  Hopefully someone has an idea which will fit my situation.

Thanks!
MP
0
Comment
Question by:mikepj
  • 4
  • 2
7 Comments
 

Expert Comment

by:moorrees
ID: 6169386
Can't you try to do it the other way?
Let your "tool window" create the "machine window"?

Or don't make your tool window a modal window.
0
 
LVL 2

Author Comment

by:mikepj
ID: 6169431
Thank you for your reply.

The tool window won't necessarily exist.

If I were to be able to change the order, I would think I would have the same problem because the tool window would instead own the modal test window.

I think I've solved the problem by:

1) using the FormResize event as a time to recreate the window
2) put up a semaphore so that it's impossible for any use of the window to be attempted between FREE and :=nil (there's nothing inbetween them but when I did that, it seems to work fine.)

Thanks again for your comments!  Just now I think I'll leave it alone--it works!
MP
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 200 total points
ID: 6170406
Hello

  Try to do that in FormActivate event.
  could u send me a copy of ur program and what do u want to do at nasman@mogaza.org
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:moorrees
ID: 6170889
So the answer is:

use the FormResize event as a time to recreate the window
and put up a semaphore so that it's impossible for any use of the window to be
attempted between FREE and :=nil (there's nothing inbetween them but when I did that,
it seems to work fine.
0
 
LVL 2

Author Comment

by:mikepj
ID: 6171399
Hi Moorrees,

I guess you don't know how Experts Exchange works.  You've "recycled" my answer; if I were to accept the answer, two things happen:

- nobody will provide a better answer
- I give the points away rather than keeping the points when I had I had provided my own answer.

Thanks,
MP
0
 
LVL 2

Author Comment

by:mikepj
ID: 6171412
Thank you for your answer.  

I totally forgot about FormActivate.  It works great now--thanks!

I also did the following so frmToBeDestroyed would be made unavailable before destruction started.

frmSave:=frmToBeDestroyed;
frmToBeDestroyed:=nil;
frmSave.Free;

I knew there must have been a better answer!

Thanks,
MP
0
 
LVL 2

Author Comment

by:mikepj
ID: 6181990
Found out some more through experience; I figured I'd relate my experiences in case anyone else finds them to be useful.

If form A is the parent of form B I will have problems if I don't destroy form B before closing form A.
I've changed it now so upon activate of form A, form B will be created.  Upon close of  form A, form B will be destroyed.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Machine not responding during CopyFile() 3 88
Printing problem 2 80
How to debug For loops? 3 45
CheckListBox usage 3 48
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 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