alexist Цитата: Помогите с TdxBarManager и TForm.WindowMenu
Может это поможет.
[more]
>We have a dxBarManager and have created a "MainMenu" with it. We also have
>some popup menus linked via the PopupLinks property. On the Form, we cannot
>select the dxBarManager's "Window" menu, because the drop down list for the
>Form.WindowMenu property is empty.
>How do we make this work?
It's manual but is pretty easy.
* Create a TdxListItem or a TdxInPlaceSubItem
* Create the click handler
procedure TForm1.WinBarButtonClick( Sender: TObject );
begin
ShowWindow( TForm( ( Sender as TdxBarButton ).Data ).Handle,
SW_RESTORE );
TForm( ( Sender as TdxBarButton ).Data ).BringToFront;
end;
{In prinicple, only one is needed but with MDI applications, I found
that only calling both of these have proper effect}
* create a procedure to add your forms to the list
MenuItem: TdxBarButton;;
begin
MenuItem:= TdxBarButton.Create( dxBarManager1 );
MenuItem.Caption := YourForm.Caption;
MenuItem.Data := YourForm;
MenuItem.OnClick := WinBarButtonClick;
SubItem.ItemLinks.Add.Item := MenuItem;
end;
* To delete the form from the list, you must write a procedure to find
the right button and then just call BatButton.Free.
---
Rajko Bogdanovic - DX Squad
THANKS. Before receiving your post, I experimented with using a
dxBarMRUList. Everything seems to work OK. I am using the following code
to identify and activate the child window selected from the MRUList.
var
szTemp : String;
I : Integer;
begin
szTemp :=
AnsiLowerCase(ExtractFileName(dxBarMRUList.Items.Strings[dxBarMRUList.ItemIn
dex]));
with MyForm do
for I := MDIChildCount - 1 downto 0 do begin
if AnsiLowerCase(MDIChildren[I].Caption) = szTemp then begin
MDIChildren[I].BringToFront;
BREAK;
end;
end;
end;
This allows me to extend the above code to persist the MRU List, and if an
item is selected from the list, but is currently not in the MDIChildren
array, then I can call the "open" action to open the file.
[/more]