Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Thread Tools Display Modes
Old 02-02-2001, 07:04 AM
jgama jgama is offline
Junior Member
Join Date: Feb 2001
Posts: 1
Default MDI x SDI

The system we are developing at this moment uses the MDI concept. Some forms are called from the MainMenu and also from another form. In the second case, we need to change the formStyle property to fsNormal so we can show it using ShowModal. At design time, the form is MDIChild and the visible property is forced to be true, starting the execution of OnShow event when the create method is called. When we changed the formStyle property to fsNormal, the OnShow event is executed for the second time and when we use the ShowModal method, the OnShow event is executed for the third time. As we feed a DbGrid during the OnShow event, the performance of application during the opening Form was denied, and many other problems could happen because the three times execution of the commands.

As we need to call forms from the MainMenu as MDIForm, and from another form as normal form using ShowModal, what is the solution to not execute the OnShow event three times?
Reply With Quote
Old 02-02-2001, 07:40 AM
MrBaseball34 MrBaseball34 is offline
Senior Member
Join Date: Jan 2001
Posts: 7,260
Default RE: MDI x SDI

Use the Tag property and a case statement and set the OnShow to nil.

Set the tag to 1 when you need to use the OnShow and
0 when you need to not use the OnShow.

case Form1.Tag of
0: Form1.OnShow := nil;
1: Form1.OnShow := Form1Show;
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT. The time now is 03:20 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2018, vBulletin Solutions, Inc.