フィルターのクリア

How To call callback function in winform?

3 ビュー (過去 30 日間)
Oren B
Oren B 2014 年 1 月 4 日
コメント済み: Abdunnoer 2014 年 11 月 19 日
i am trying to build winform in matlab i have button and i want to create callback to that button for some reason it not call the function that i create can some one tell me how to create callback in winform?
% code
function WinforMatlab
NET.addAssembly('System.Windows.Forms');
import System.Windows.Forms.*;
%%create Form
f = Form;
f.Show
%%Create Button
b=Button;
b.Text='Hello';
b.Location.X=20;
b.Location.Y=40;
%%for some reason that function not call!
h=addlistener(b, 'MouseDoubleClick',@ eventhandlerChanged);
b.Parent=f;
%%this is my callback function
function eventhandlerChanged(~,~)
disp('hey')
end
end
  1 件のコメント
Abdunnoer
Abdunnoer 2014 年 11 月 19 日
from MSDN : By default, the ControlStyles.StandardClick and ControlStyles.StandardDoubleClick style bits are set to false for the Button control, and the MouseDoubleClick event is not raised.
1) Works on Single Click. 2) Derive from Button and override controlstyle if neccessary or possible when double click event is required on button.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by