「マクロ覚え書き(開発者向け)」の版間の差分
#iconの=抜けを修正 |
細 Editor.OpenFile()がDocumentオブジェクトを返すまでのポリフィル |
||
| 169行目: | 169行目: | ||
PopupMenu.Add() の ID は必ず 0 以外にしましょう.<br> | PopupMenu.Add() の ID は必ず 0 以外にしましょう.<br> | ||
PopupMenu.Track() はキャンセルされた(メニューが押されなかった)場合,0 を返します. | PopupMenu.Track() はキャンセルされた(メニューが押されなかった)場合,0 を返します. | ||
== Editor.OpenFile()の戻り値 == | |||
Editor.OpenFile()は開いたDocumentオブジェクトを返さない. | |||
Editor.OpenFile()が開いたDocumentオブジェクトを返すようにするポリフィル | |||
<source lang="javascript"> | |||
function OpenFile(file, encoding, flags){ | |||
var i, j, e, d; | |||
window.Editor.OpenFile(file, encoding, flags); | |||
for(i = 0; i < window.Editors.Count; i++){ | |||
e = window.Editors.Item(i); | |||
for(j = 0; j < e.Documents.Count; j++){ | |||
d = e.Documents.Item(j); | |||
if(d.FullName){ | |||
if(d.FullName === file){ | |||
return d; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
</source> | |||
スポンサーリンク