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

Commit ab86207

Browse files
committed
[[ 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.
1 parent 46297e0 commit ab86207

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

Toolset/palettes/inspector/behaviors/revinspectoreditorbehavior.livecodescript

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

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

Toolset/palettes/inspector/editors/com.livecode.pi.customprops.behavior.livecodescript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ on editorUpdate
6969
if the result is empty then
7070
put tKey into field "value" of me
7171
put item -1 of tPath into field "key" of me
72+
select the text of field "key" of me
7273
else
7374
put empty into field "key" of me
7475
put empty into field "value" of me

notes/bugfix-21484.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Allow scroll wheel to work in PI text fields
2+
3+
# Automatically select text of fields in PI

0 commit comments

Comments
 (0)