線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2064
推到 Plurk!
推到 Facebook!

OTA - How to create and add new menu item to Delph

 
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-01-14 10:55:33 IP:61.218.xxx.xxx 未訂閱

OTA - How to create and add new menu item to Delphi IDE

by Miha Remec (mail@miharemec.com).
資料來源: http://www.miharemec.com/doc/ota-nmi.html Note: This example is a simplified version of New Unit expert and taken from mrExperts, set of experts for Delphi. More information is available from mrExperts' homepage. How to create and add new menu item to Delphi IDE 1. declare private variables
  FMainMenu: TMainMenu;
  FFileMenu: TMenuItem;
  FNewMenuItem: TMenuItem;
2. find original Delphi menu items
  // find Delphi's main menu
  FMainMenu := (BorlandIDEServices as INTAServices).MainMenu;
  // find File
  FFileMenu := FMainMenu.Items.Find('File');
3. create new menu item and associate OnClick event handler
  FNewMenuItem := TMenuItem.Create(FFileMenu);
  FNewMenuItem.Caption := 'mrExperts';
  FNewMenuItem.OnClick := OnMenuItemClick;
4. add new menu item into File menu, before the first separator // find first separator
  for i := 0 to FFileMenu.Count - 1 do begin
    if FFileMenu.Items[i].IsLine then begin
      FFileMenu.Insert(i, FNewMenuItem);
      Break;
    end;
  end;
How to destroy and remove new menu item from Delphi IDE 1. remove new menu item
  i := 0;
  while i < FFileMenu.Count do begin
    if AnsiSameCaption(FFileMenu.Items[i].Caption, 'mrExperts') then
      FFileMenu.Remove(FFileMenu.Items[i])
    else
      Inc(i);
  end;
2. free new menu item FNewMenuItem.Free; Download the source code Full source is available for download. Document created: 2000-08-24 Last revised: 2000-11-19 BACK to articles Copyright © 2000 by Miha Remec 聯盟----Visita網站http://www.vista.org.tw ---[ 發問前請先找找舊文章 ]--- 發表人 - axsoft 於 2003/01/14 10:58:56
系統時間:2024-04-24 13:38:51
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!