Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Can MDI child be minimized to an ICON?

Posted on 1998-10-19
4
Medium Priority
?
350 Views
Last Modified: 2010-04-06
Hi,

Can you minimize a MDI child form to an Icon rather than just a small form caption bar??

If it is easy just say yes, but if it requires some complicated inheritance and changing of the basic code of a Form then please supply code with answer.  (* I will increase the points if it turns out to be more difficult than it sounds *).
0
Comment
Question by:Zonnald
[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
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
Thaddy earned 80 total points
ID: 1343331
Yes it's possible and no, it's not easy.
If you use Windows NT 3.51, it's easy enough, just don't do anything.(About win 3.51 look)
It's because the implementaion has changed in  NT 4 and Win 95 that this behaveour has changed.
First you have to remove the bar:
That's easy enough here's an example

procedure TForm2.FormResize(Sender: TObject);
begin
  //Mdi child close *without* titlebar
  if windowstate=wsMinimized then
  if ShowWindow(Self.Handle, SW_HIDE)=true then
   //in Real life you would create this dynamically,
and add code to do an 'Arrange Icon'
  form1.image1.picture.Assign(self.icon);
end;

The doubleclickhandler for the Image should read:
{You can lookup the MDIchild in ther MdiChildren list}
procedure TForm1.Image1DblClick(Sender: TObject);
begin
//This is for one mdichild only, but you can expand the imagelist
//With a property 'AssociatedChild' or something
      SetWindowPos(form2.Handle, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE OR
         SWP_NOSIZE OR SWP_SHOWWINDOW);
       Windows.SetFocus(Form2.Handle);
end;

Although by no means complete, that's a way to do it.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1343332
Um.. I'n confused. What is the role of 'form1' in the resize event?

(I agree, Mickeysoft changed the way they do things between 3.1 and 95/NT (4.00). We had the same issue but gave up and did it another way...)
0
 
LVL 1

Author Comment

by:Zonnald
ID: 1343333
Thaddy

Works Ok!


I see that Form1 (nb rw) would be your main form - you need to so that you have somewhere to display the image. have a panel to see the image. I made the image a Dockable object and the panel a dock site and had some fun being able to move it around with out having to make any mouse event code.

It is also interesting that as you have coded it, this works when you hit the X but not actually when you hit minimize icon?



Thanks

Zonnald.
0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1343334
This behaveour is expected: Minimizing ain't closing :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

670 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