Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vecs
FIJI Public
Commits
3d7961a7
Commit
3d7961a7
authored
Aug 17, 2016
by
Christian Fibich
Committed by
Stefan Tauner
May 04, 2018
Browse files
Search for nearest ancestor widget when scrolling with mousewheel
parent
061d8756
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/Tk/FIJIUtils.pm
View file @
3d7961a7
...
...
@@ -189,27 +189,31 @@ sub _wheel_handler {
my
(
$event_widget
,
$val
,
$mw
)
=
@_
;
for
(
my
$index
=
0
;
$index
<
@
{
$mw
->
{'
scrollable_widgets
'}};
$index
++
)
{
my
$widget_to_scroll
=
@
{
$mw
->
{'
scrollable_widgets
'}}[
$index
];
# remove already deleted widgets from list
unless
(
Tk::
Exists
(
$widget_to_scroll
))
{
delete
@
{
$mw
->
{'
scrollable_widgets
'}}[
$index
];
next
;
}
# only scroll if visible
next
if
(
!
$widget_to_scroll
->
ismapped
());
my
$scrolled
=
$widget_to_scroll
->
Subwidget
('
scrolled
');
my
$container
;
for
(
$container
=
$event_widget
;
defined
$container
&&
$container
!=
$widget_to_scroll
;
$container
=
$container
->
parent
)
{}
next
if
(
!
defined
$container
);
if
(
$^O
eq
"
MSWin32
")
{
$scrolled
->
yview
(
scroll
=>
(
-
$val
/
120
)
*SCROLL
,'
units
');
}
else
{
$scrolled
->
yview
(
scroll
=>
$val*SCROLL
,'
units
');
my
$container
;
# search through hierarchy of widget causing the event
# for the nearest ancestor in the list of widgets to be scrolled
for
(
$container
=
$event_widget
;
defined
$container
;
$container
=
$container
->
parent
)
{
# search the list of the widgets to be scrolled
for
(
my
$index
=
0
;
$index
<
@
{
$mw
->
{'
scrollable_widgets
'}};
$index
++
)
{
my
$widget_to_scroll
=
@
{
$mw
->
{'
scrollable_widgets
'}}[
$index
];
# remove already deleted widgets from list
unless
(
Tk::
Exists
(
$widget_to_scroll
))
{
delete
@
{
$mw
->
{'
scrollable_widgets
'}}[
$index
];
next
;
}
next
if
$container
!=
@
{
$mw
->
{'
scrollable_widgets
'}}[
$index
];
my
$scrolled
=
$widget_to_scroll
->
Subwidget
('
scrolled
');
if
(
$^O
eq
"
MSWin32
")
{
$scrolled
->
yview
(
scroll
=>
(
-
$val
/
120
)
*SCROLL
,'
units
');
}
else
{
$scrolled
->
yview
(
scroll
=>
$val*SCROLL
,'
units
');
}
goto
END
;
}
}
END
:
return
;
}
1
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment