Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.1.0 - 日本語


event handler functions

イベントハンドラとして使用できる関数のプロトタイプ.

呼び出し手順

envent_handler_function(win,x,y,ibut)

パラメータ

win

イベントが発生したwindowの番号.

x

イベントが発生した時のマウスポインタのX座標(単位:ピクセル).

y

イベントが発生した時のマウスポインタのY座標(単位:ピクセル).

ibut

イベント型に対応する番号.

説明

イベントハンドラモードが有効な場合, Scilab は指定したイベントハンドラ関数を グラフィックウインドウにイベントが発生する度にコールします. イベントハンドラ関数は前記のプロトタイプに適合している必要があります. イベントが発生する度に, 関数がコールされ, その4つのパラメータが ウインドウ番号,マウスの位置およびイベントの型に設定されます.

ibutパラメータはイベント型に依存した以下の値のどれかと なります:

ibut==0

マウスの左ボタンが押されました

ibut==1

マウスの真ん中のボタンが押されました

ibut==2

マウスの右ボタンが押されました

ibut==3

マウスの左ボタンがクリックされました

ibut==4

マウスの真ん中のボタンがクリックされました

ibut==5

マウスの右ボタンがクリックされました

ibut==10

マウスの左ボタンがダブルクリックされました

ibut==11

マウスの真ん中のボタンがダブルクリックされました

ibut==12

マウスの右ボタンがダブルクリックされました

ibut==-5

マウスの左ボタンが離されました

ibut==-4

マウスの真ん中のボタンが離されました

ibut==-3

マウスの右ボタンが離されました

ibut==-1

マウスポインタが移動されました

ibut > =32

アスキーコード ascii(ibut) を有するキーが押されました

ibut < =-32

アスキーコード ascii(-ibut) を有するキーが離されました

ibut > =1000+32

アスキーコード ascii(ibut-1000) を有するキーがCTRLキーと共に押されました

ibut==-1000

グラフィックウインドウが閉じられました

ibut==-10000

Unmanaged event. It might be a drag and drop or a fast click and move

例えば, ウインドウ番号0のイベントハンドラ関数の名前をfooHandlerとしましょう. このウインドウの位置 [100,150] (単位:ピクセル)で左クリックをすると, fooHandler( 0, 100, 150, 3 ) をコールするのと等価となります.

イベントハンドラの名前の指定方法に関する情報については figure_properties または seteventhandler を参照ください.

function my_eventhandler(win, x, y, ibut)

  if ibut==-1000 then return,end

  [x,y]=xchange(x,y,'i2f')

  gcf().info_message = msprintf('Event code %d at mouse position is (%f,%f)',ibut,x,y);

endfunction

plot2d()

fig = gcf() ;

fig.event_handler = 'my_eventhandler' ;

fig.event_handler_enable = "on" ;

//now:

//   -  move the mouse over the graphic window

//   -  press and release keys shifted or not with Ctrl pressed or not

//   -  press button, wait a little release

//   -  press and release button

//   -  double-click button

fig.event_handler_enable = "off" ; //イベントハンドラを停止

参照

  • figure_properties — グラフィックエンティティプロパティの説明
  • seteventhandler — カレントのグラフィックウインドウのイベントハンドルを設定
  • xgetmouse — マウスのイベントおよびカレントの位置を取得する
  • xclick — マウスクリップを待つ.
Report an issue
<< edit_curv interaction locate >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon May 22 12:43:11 CEST 2023