Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying form behavior in a multi-form app

Status
Not open for further replies.

stevemelaaron

Programmer
Sep 14, 2000
25
0
0
US
I have a multi-form (non-MDI) app that I'm developing. When the user activates one of the forms in the app by clicking on it, all of the other forms in my app come to the top of the z-order. Is there any way to change this behavior? I would like to make it so that only the form that has been clicked comes to the foreground. I have tried to make an ActiveX .EXE with the thread per instance option out of the form that I'm creating multiple instances of, and this does create the effect that I'm looking for, but after creating 10 or 15 instances of the form, VB issues an "Out of memory" error.

Any ideas?

--Steve
stevemelaaron@msn.com
 
Do u have all these forms without a hierarchy?
I don't understand what r u doing that cause several forms open at the same that cause that all come up at the same time?
Options
.Hide what u don't need
.Stablish a hierarchy(Mdi, Modals)

When ur programming there's a rule if cannot make it works in one way look for another. And if don't have time the easiest one is the best solution.
Think! u might have the answer of ur own question.
 
The forms are non-heirarchial. Initially, my app runs and has no visible forms on the desktop. It is set up to trap a three-key hotkey combination from the user to create a new instance of a form on the desktop. Each instance is has equal status, is non-MDI, and the user must be able to freely switch from form to form (thus the non-modality of the forms). To visualize this, think "Post-it" note. When you click on one instance of the note, you don't want all of them to immediately pop to the foreground, just the one that you clicked on. You also don't want screen flicker or the zorder of the other notes to be altered (so it is fairly cumbersome or even impossible to use the zorder method or the SetWindowPos API function to put the notes back in their original order on the screen after VB has brought them all to the front). So......any other suggestions?

Thanks for the reply, though.
 
I would be led to believe that the other forms are actually bringing themselves to the top of the screen systematically, like when you load the new form, something behind the scenes is accessing all the forms therefore popping up each form along the way...

Otherwise the only other thing I can think of is to load all the forms into memory and then use the show and hide methods to bring it on and off the screen then use the unload method to get them out of memory.


Hope this helps...
 
Actually, by design, when you have a VB program that has more than one form (in the case of a non-MDI program), when the user clicks on one of them, all of the other forms associated with the program are brought to the foreground. And yes, it is something going behind the scenes - normally, I believe that all of the forms associated with an app are attached to the same thread as the app, and therefore pop up to the foreground when another form from the same app is activated. The only way so far that I have found to get around this is to assign each form that I want to act independently of the other forms a different thread, which can be accomplished by creating it as an ActiveX .EXE and checking the "Thread per object" option (it's actually a bit more complicated than that, but that's what it boils down to). Unfortunately, assigning each new instance its' own thread evidently eats resources like they're going out of style, and after creating about 10 or 15 instances of the form/control, VB fires an error indicating that I'm out of memory. Clearly, this is not acceptable behavior, so I am forced to find another way around the problem.

Thank you for the reply!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top