Member_2_7965240
asked on
Delphi Mdi application Child forms get behind control
Hello,
I have an MDI application created in Delphi (the application has many reasons to be MDI, one of them, that the menu of the main form is always visible and clickable even if other forms are open).
The problem:
I put some Tile controls on the Main form so as the user can start some functions even easier.
When I open a child form it is shown behind the tile control, so it is not visible.
How can I avoid this?
Thank you.
I have an MDI application created in Delphi (the application has many reasons to be MDI, one of them, that the menu of the main form is always visible and clickable even if other forms are open).
The problem:
I put some Tile controls on the Main form so as the user can start some functions even easier.
When I open a child form it is shown behind the tile control, so it is not visible.
How can I avoid this?
Thank you.
ASKER
Geert Gruwez: thank you for the answer.
The child.BringToFront doesn't work, the child form is still behind the Tile controls.
And this is which maybe you misunderstood: I wrote "Tile controls" and not tile forms.
I use Devexpress TdxTileControl (but anyway if I put a simple Button on the main form, the child form will get under it too).
Thank you.
The child.BringToFront doesn't work, the child form is still behind the Tile controls.
And this is which maybe you misunderstood: I wrote "Tile controls" and not tile forms.
I use Devexpress TdxTileControl (but anyway if I put a simple Button on the main form, the child form will get under it too).
Thank you.
well yes.
If you put the TdxTileControl in the main form that's the way it will work
create an mdi child with that TdxTileControl inside it
I used the sample of the Mdi application and added this:
you'll have to write some code to handle bringing the menu to the front
components you place directly on the Mdi Main form always appear on top
you have to move controls to an mdichild window
and place the mdichild window on the main form
If you put the TdxTileControl in the main form that's the way it will work
create an mdi child with that TdxTileControl inside it
I used the sample of the Mdi application and added this:
unit uTileMenu;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls, dxTileControl,
cxLookAndFeels, cxLookAndFeelPainters, dxCustomTileControl, cxClasses;
type
TmdiTileMenu = class(TForm)
dxTileControl1: TdxTileControl;
dxTileControl1Group1: TdxTileControlGroup;
dxTileControl1Item1: TdxTileControlItem;
dxTileControl1Item2: TdxTileControlItem;
dxTileControl1Item3: TdxTileControlItem;
private
{ Private declarations }
public
{ Public declarations }
end;
var
mdiTileMenu: TmdiTileMenu;
implementation
{$R *.dfm}
end.
object mdiTileMenu: TmdiTileMenu
Left = 346
Top = 274
BorderIcons = []
BorderStyle = bsNone
ClientHeight = 358
ClientWidth = 741
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
FormStyle = fsMDIChild
OldCreateOrder = False
Visible = True
WindowState = wsMaximized
PixelsPerInch = 96
TextHeight = 13
object dxTileControl1: TdxTileControl
Left = 0
Top = 0
Width = 741
Height = 358
TabOrder = 0
ExplicitLeft = -151
ExplicitTop = 189
ExplicitWidth = 892
ExplicitHeight = 169
object dxTileControl1Group1: TdxTileControlGroup
Index = 0
end
object dxTileControl1Item1: TdxTileControlItem
GroupIndex = 0
IndexInGroup = 0
Size = tcisLarge
Text1.AssignedValues = []
Text2.AssignedValues = []
Text3.AssignedValues = []
Text4.AssignedValues = []
end
object dxTileControl1Item2: TdxTileControlItem
GroupIndex = 0
IndexInGroup = 1
RowCount = 2
Size = tcisExtraLarge
Text1.AssignedValues = []
Text2.AssignedValues = []
Text3.AssignedValues = []
Text4.AssignedValues = []
end
object dxTileControl1Item3: TdxTileControlItem
GroupIndex = 0
IndexInGroup = 2
Size = tcisSmall
Text1.AssignedValues = []
Text2.AssignedValues = []
Text3.AssignedValues = []
Text4.AssignedValues = []
end
end
end
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure CreateMDIChild(const Name: string);
procedure WMUser(var Msg: TMessage); message WM_USER;
public
{ Public declarations }
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
PostMessage(Handle, WM_USER, 1, 0);
end;
procedure TMainForm.WMUser(var Msg: TMessage);
var tm: TmdiTileMenu;
begin
tm := TmdiTileMenu.Create(Application);
end;
you'll have to write some code to handle bringing the menu to the front
components you place directly on the Mdi Main form always appear on top
you have to move controls to an mdichild window
and place the mdichild window on the main form
change properties of the mdi child form for the menu :
BorderIcons = []
BorderStyle = bsNone
FormStyle = fsMDIChild
WindowState = wsMaximized
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Geert Gruwez:
Thank you for the answer.
I checked it but at me the frame of the tile doesn't contain detailcontrol property.
Thank you
Thank you for the answer.
select a tile, check the frames property, and add 1 if you haven't already
in frame set the detailcontrol to the panel you just created
I checked it but at me the frame of the tile doesn't contain detailcontrol property.
Thank you
i was going to create sample ... but the TileControl has bugs !
at least my version has: 14.2.7
I added 3 panels on my form
then assigned each to an item
hit F9
then changed the text1 of each item
and all my panels disappeared !
they were deleted from the form
yuck ...
it seems to force you to work with frames, assigning them at runtime to each item
at least my version has: 14.2.7
I added 3 panels on my form
then assigned each to an item
hit F9
then changed the text1 of each item
and all my panels disappeared !
they were deleted from the form
yuck ...
it seems to force you to work with frames, assigning them at runtime to each item
The Forms/Windows inside the MainForm container have a Z order
BringToFront place it at the top
Open in new window
Alternative:
You could also move all the Tile forms to the back with the method SendToBack