Solved

MDI Bug-Fix in Delphi 5 this is not a Question ;-)

Posted on 2000-04-21
5
490 Views
Last Modified: 2010-04-04
Fixing the Borland Delphi MDI problems.
Since Inprise hasn't very interests of fixing her bug, I post it here!

greating
Thomas

------------------------------------------------------------------------------------------------------------------

The following MergeMenu function fixes two bugs
=======================================

When do the Bugs appear:

- more than one MDI-Child is maximized and
- switching to another window and
- the child has a menu and
- the menu on the MainMenu's property "automerge=true"

The Bugs are:

1.) The close button grayed out.
2.) In Delphi 5 the system-icons and Menu where drawn correctly, but the mdi-child-system-icons are missing. So the menu moves left and under win98/2000 this looks very funny.
------------------------------------------------------------------------------------------------------------------

How to fix:
========

1.) Sorry You can only do it, if you have the professional or enterprise version.

2.) Add the source path in the environment options:
Menu => Tools/Environment options
Tab => Library
Library path => $(DELPHI)\Source\VCL

3.) Edit Forms.pas

4.) Compile the your MDI-Application

------------------------------------------------------------------------------------------------------------------
Full Source of the function:
======================

procedure TCustomForm.MergeMenu(MergeState: Boolean);
var
AMergeMenu: TMainMenu;
//Add these variables here
Size,
Style : longint;
begin
if not (fsModal in FFormState) and
(Application.MainForm <> nil) and
(Application.MainForm.Menu <> nil) and
(Application.MainForm <> Self) and
((FormStyle = fsMDIChild) or (Application.MainForm.FormStyle <> fsMDIForm)) then
begin
AMergeMenu := nil;
if not (csDesigning in ComponentState) and (Menu <> nil) and
(Menu.AutoMerge or (FormStyle = fsMDIChild)) then AMergeMenu := Menu;
with Application.MainForm.Menu do
if MergeState then Merge(AMergeMenu) else Unmerge(AMergeMenu);
// =====================> Add in Delphi 5 <==================
if MergeState and (FormStyle = fsMDIChild) and (WindowState = wsMaximized) then
begin
{ Force MDI to put back the system menu of a maximized child }
Size := ClientWidth + (Longint(ClientHeight) shl 16);
SendMessage(Handle, WM_SIZE, SIZE_RESTORED, Size);
// ==================> Remove from Delphi 2?,3?,4 <================
// SendMessage(Handle, WM_SIZE, SIZE_MAXIMIZED, Size);
// ====================> Add in Delphi 2?,3?,4,5 <=================
//new lines to patch the grayed out close-button
Style:=GetWindowLong(Handle,GWL_STYLE) or ws_sysmenu;
SetWindowLong(Handle, GWL_STYLE, Style);
end;
// ==========================================================
end;
end;
 
0
Comment
Question by:huehnsoftware
[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
  • 3
5 Comments
 

Accepted Solution

by:
huehnsoftware earned 50 total points
ID: 2738622
cool *g*
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 2741464
Perhaps this replaces my ugly workaround...
0
 
LVL 3

Expert Comment

by:darinw
ID: 3084704
This question has been undeleted.  The points for this question were originally 50 but have been reduced to 0
0
 
LVL 3

Expert Comment

by:darinw
ID: 3084730
Hi everyone. I just happened to stumble across this one while looking through a search on a mostly unrelated matter.

huehnsoftware - you have to accept an answer to a question or it will be deleted by the system after 21ish days.

darinw
Customer Service
0
 
LVL 3

Expert Comment

by:darinw
ID: 3084732
Comment accepted as answer
0

Featured Post

Independent Software Vendors: 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

Suggested Solutions

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

763 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