Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 781
  • Last Modified:

MDI Taskbar

I have a MDI form. I need a taskbar for the MDI children, like the switchbar in mIRC, which does the same thing. I have searched all over, but i can't find any. I saw some taskbars on www.torry.net/taskbars.htm, but they don't work in DELPHI 7 (the version i have) or they don't have any source code. Could you tell me how to create such taskbar, or make me a component(TTaskBar for example) ?

My e-mail is sandy@alexandrion.ro
0
SandyXP
Asked:
SandyXP
  • 4
1 Solution
 
SandyXPAuthor Commented:
I think i could use a ttoolbar or something like that do do this.
0
 
jgilmCommented:
You could make your own. Put the following in a procedure and call it every time an MDI is created or destroyed (or hidden). This will create buttons for as many MDI windows as are available. You may have to modify this to get them to look how you want them. The event that is assigned to the OnClick brings the window to the foreground. The window number (in the MDIChildren array) is stored in the tag property of the toolbutton, but there are other ways to link the button and the window.

procedure TMainForm.UpdateToolbar;
begin
  for I := Toolbar1.ButtonCount - 1 downto 0 do
      ToolBar1.Buttons[I].Free;

  for I := 0 to MainForm.MDIChildCount - 1 do
  begin
    with TToolButton.Create(toolbar1) do
    try
      AutoSize  := True;
      Grouped   := True;
      Parent    := Toolbar1;
      Tag       := i;
      Caption := MainForm.MDIChildren[i].Caption;
      OnClick   := ToolButtonClick;
    except
      Free;
      raise;
    end;
  end;
end;

procedure TMainForm.ToolButtonClick(Sender: TObject);
begin
  MainForm.MDIChildren[ (Sender as TToolButton).Tag ].BringToFront;
end;

-- jgilm
0
 
SandyXPAuthor Commented:
Well, it kindda works..
But there are some major problems:
- How can I place every ToolButton on a new row? (i want the toolbar to be vertical, not horizontal like the windows taskbar)
- I have multiple mdi children but i can only select them by clicking on the first toolbutton, which iterates through the windows, putting them on top one by one. I tested it with 2 windows and when i click the second button nothing happens.

Could you help me?
AND one more thing: where EXACTLY shoud i place the UpdateToolBar procedure?
0
 
SandyXPAuthor Commented:
And btw, i need another thing:
Please tell me how to insert images into a TRichEdit:)
I am making a chat prog and i want to insert emotion-icons, smileys
I have found something with ole functions, a lot of code, and it inserts the image by
  copying the TPicture in the clipboard and pasting it in the RichEdit
Do you know any other method to insert an image into TRichEdit?
And if you do, please tell me also how to search for any ':)' text in the richedit and transform it into the smiley image.
0
 
SandyXPAuthor Commented:
And btw, i need another thing:
Please tell me how to insert images into a TRichEdit:)
I am making a chat prog and i want to insert emotion-icons, smileys
I have found something with ole functions, a lot of code, and it inserts the image by
  copying the TPicture in the clipboard and pasting it in the RichEdit
Do you know any other method to insert an image into TRichEdit?
And if you do, please tell me also how to search for any ':)' text in the richedit and transform it into the smiley image.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now