Just FYI:
Whilst fooling around with the Syntax hilighting in the previous post, I noticed something odd when themes were enabled.
That is, in ASCRIPT.INC, if I enable directive {$DEFINE THEMED_IDE} then there are strange side-effects.
Namely: when running the ScripterProIDE sample, the "about" menu item is not visible (the code in OnCreateEditor runs, but the new "about" menu item never appears on the main menu.
Cheers,
EdB
Hi Ed, thanks for the feedback. Indeed, the mechanism for creating the theme menu is completely different, some workarounds are needed. That is not included in demo because you would have to add "AdvMenus" and "AdvToolBar" to the uses clause. You can add those and then use this code for themed ide:
procedure TForm1.OnCreateEditor(Sender: TObject);
var
AMenu: TMainMenu;
AItem: TMenuItem;
ASubItem: TMenuItem;
c, d: integer;
AOldImages: TCustomImageList;
Form: TIDEEditorForm;
begin
{This callback event is only used to add an About options in the menu}
if Sender is TForm then
begin
{Create about menu and "migrate" all items from popup to the about}
Form := TIDEEditorForm(Sender);
AMenu := Form.MainMenu1;
for c := 0 to Form.ComponentCount - 1 do
if Form.Components[c] is TAdvMainMenu then
begin
AMenu := TMainMenu(Form.Components[c]);
break;
end;
IDEEngine1.Memo.OnChange := MemoChange;
AOldImages := AMenu.Images; //visual workaround
AMenu.Images := nil;
AItem := TMenuItem.Create(AMenu.Owner);
AItem.Caption := 'About';
AMenu.Items.Add(AItem);
for c := 0 to PopupMenu1.Items.Count - 1 do
begin
ASubItem := TMenuItem.Create(AMenu.Owner);
ASubItem.Caption := PopupMenu1.Items[c].Caption;
ASubItem.OnClick := PopupMenu1.Items[c].OnClick;
AItem.Add(ASuBItem);
end;
AMenu.Images := AOldImages;
for c := 0 to Form.ComponentCount - 1 do
if Form.Components[c] is TAdvDockPanel then
for d := 0 to Form.Components[c].ComponentCount - 1 do
if Form.Components[c].Components[d] is TAdvToolBar then
TAdvToolBar(Form.Components[c].Components[d]).UpdateMenu;
end;
end;