1

サイズを変更した後に選択範囲が表示されるように、フィールドをスクロールしたいと思います。そのためには、フィールドの上部から選択範囲の高さを計算してから、現在のスクロールをオフセットして新しいスクロールを作成する必要があります。fixedLineHeightを想定することはできません。誰か手がかりがありますか?

4

2 に答える 2

3

辞書を検索した後、selectedLoc関数を見つけました。フィールドのサイズを変更するたびに次のコードが実行され、目的の動作が得られました。

   put item 2 of the selectedLoc-the scroll of pField into tSelectionHeight
   if tSelectionHeight > the scroll of pField+the height of pField then
      set the scroll of pField to tSelectionHeight-the height of pField
   end if
于 2013-03-08T06:15:39.827 に答える
1

選択した場所がない場合は、以下も機能します。これをPowerDebugで使用して、デバッグウィンドウのブレークポイントまたは現在のコード行を中央に配置します。(そして、はい、私はラインの高さがフィールドで一貫していると仮定していることに気づきます)。

command CenterDebugText pLinesToHilite
  local tLineHeight, tFieldHeight
  local tScroll

  lock screen
  set the hilitedlines of field kDebugFieldName of me to pLinesToHilite
  -- center the breakpoint line in the display

  -- calculate the number of visible script lines
  put the effective textheight of field kDebugFieldName into tLineHeight
  put the height of field kDebugFieldName into tFieldHeight

  put tLineHeight * (item 1 of pLinesToHilite) into tScroll
  subtract tFieldHeight / 2 from tScroll
  set the vscroll of field kDebugFieldName to trunc(tScroll)
  unlock screen
end CenterDebugText
于 2013-03-19T20:28:09.500 に答える