Host+DLL模式下快速鍵的使用,hostdll模式快速鍵_PHP教程

來源:互聯網
上載者:User

Host+DLL模式下快速鍵的使用,hostdll模式快速鍵


最近在做一個 Host+DLL 的外掛程式系統,每個DLL模組都繼承一個基類別模組TBaseForm , 然後再基類別模組裡定義了增F1、刪F2、改F3、查F4等功能,每個功能定義了一個快速鍵,

在主程式這邊通過PageControl來載入每個DLL模組,問題來了,當我開啟多個模組時,按下 F1 時,系統調用的不是我當前啟用的 TabSheet 模組,而是第一個開啟的模組的新增

功能,原來快速鍵被第一個模組註冊後,後面開啟的模組再註冊就無效了。後來想到一個方法,就是再 TabSheet的 OnHide 事件裡把當前模組的快速鍵取消,在 onShow 事件裡

再把當前模組的快速鍵關聯起來,經過測試成功!!!,以下是部分代碼:

 1 procedure TBaseForm.bidingshortcut;       //綁定快速鍵 2 begin 3   al_new.ShortCut:=TextToShortCut('F5'); 4   al_edit.ShortCut:=TextToShortCut('F6'); 5   al_delete.ShortCut:=TextToShortCut('F7'); 6   al_refdata.ShortCut:=TextToShortCut('F8'); 7   al_query.ShortCut:=TextToShortCut('F3'); 8   al_report.ShortCut:=TextToShortCut('F2'); 9   al_export.ShortCut:=TextToShortCut('F10');10   al_import.ShortCut:=TextToShortCut('F4');11   al_gridset.ShortCut:=TextToShortCut('F9');12 end;13 14 procedure TBaseForm.unbidingshortcut;     //解除綁定快速鍵15 begin16   al_new.ShortCut:=TextToShortCut('none');17   al_edit.ShortCut:=TextToShortCut('none');18   al_delete.ShortCut:=TextToShortCut('none');19   al_refdata.ShortCut:=TextToShortCut('none');20   al_query.ShortCut:=TextToShortCut('none');21   al_report.ShortCut:=TextToShortCut('none');22   al_export.ShortCut:=TextToShortCut('none');23   al_import.ShortCut:=TextToShortCut('none');24   al_gridset.ShortCut:=TextToShortCut('none');25 end;

然後在Host程式中的onHide和onShow分別調用unbidingshortcut和bidingshortcut即可。

這裡有一個基類的轉換過程,因為我事先在tabsheet的tag裡儲存了當前表單,所以只要做以下轉換:

TBaseForm(TabSheet.tag).bidingshourtcut 就可以了。

http://www.bkjia.com/PHPjc/915784.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/915784.htmlTechArticleHost+DLL模式下快速鍵的使用,hostdll模式快速鍵 最近在做一個 Host+DLL 的外掛程式系統,每個DLL模組都繼承一個基類別模組TBaseForm , 然後再基類別模組...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.