Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 902549e

Browse files
livecodealilivecodepanos
authored andcommitted
[[ Bug 21484 ]] Allow scroll wheel to work in PI text fields (#2050)
* [[ Bug 21484 ]] Allow scroll wheel to work in PI text fields Include a `rawKeyDown` handler in the `revinspectoreditorbehavior` to intercept pgup/pgdn/scroll wheel messages when inside a text field. If the field is not at either limit, then the messages will scroll the text field. If at a limit, then the messages will bubble up to the parent card. Add `openField` handler to select the text of fields. For the custom properties behavior, when a key is selected in the tree view widget, then the corresponding key text will also be selected. (cherry picked from commit ab86207) * [[ Bug 21484 ]] Allow scroll wheel to work in PI text fields Remove automatic select changes to split to another PR. (cherry picked from commit 06d04ed)
1 parent 8b85897 commit 902549e

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

Toolset/palettes/inspector/behaviors/revinspectoreditorbehavior.livecodescript

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,41 @@ end editorExpandVertical
301301

302302
getProp editorExpandVertical
303303
return sExpandVertical
304-
end editorExpandVertical
304+
end editorExpandVertical
305+
306+
on rawKeyDown pKeyNum
307+
-- allow scroll wheel, pgup, & pgdn to scroll the text field
308+
-- bubble up to the parent if at either limit
309+
if the target contains "field" then
310+
local tScrollPosition, tScrollAmount, tScrollMax
311+
put the vScroll of the target into tScrollPosition
312+
put 0 into tScrollAmount
313+
switch pKeyNum
314+
case "65365"
315+
put 45 into tScrollAmount
316+
-- fall through
317+
case "65309"
318+
if tScrollPosition is 0 then pass rawKeyDown
319+
add 5 to tScrollAmount
320+
put max(0, tScrollPosition - tScrollAmount) into tScrollPosition
321+
break
322+
case "65366"
323+
put 45 into tScrollAmount
324+
-- fall through
325+
case "65308"
326+
add 5 to tScrollAmount
327+
put the formattedHeight of the target - \
328+
the height of the target into tScrollMax
329+
if tScrollPosition is tScrollMax then pass rawKeyDown
330+
put min(tScrollMax, tScrollPosition + tScrollAmount) \
331+
into tScrollPosition
332+
break
333+
default
334+
pass rawKeyDown
335+
end switch
336+
set the vScroll of the target to tScrollPosition
337+
else
338+
pass rawKeyDown
339+
end if
340+
end rawKeyDown
341+

notes/bugfix-21484.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Allow scroll wheel to work in PI text fields

0 commit comments

Comments
 (0)