| 1 | # NOTE: Derived from blib/lib/Tk.pm. |
| 2 | # Changes made here will be lost when autosplit is run again. |
| 3 | # See AutoSplit.pm. |
| 4 | package Tk; |
| 5 | |
| 6 | #line 449 "blib/lib/Tk.pm (autosplit into blib/lib/auto/Tk/focusNext.al)" |
| 7 | sub focusNext |
| 8 | { |
| 9 | my $w = shift; |
| 10 | my $cur = $w; |
| 11 | while (1) |
| 12 | { |
| 13 | # Descend to just before the first child of the current widget. |
| 14 | my $parent = $cur; |
| 15 | my @children = $cur->FocusChildren(); |
| 16 | my $i = -1; |
| 17 | # Look for the next sibling that isn't a top-level. |
| 18 | while (1) |
| 19 | { |
| 20 | $i += 1; |
| 21 | if ($i < @children) |
| 22 | { |
| 23 | $cur = $children[$i]; |
| 24 | next if ($cur->toplevel == $cur); |
| 25 | last |
| 26 | } |
| 27 | # No more siblings, so go to the current widget's parent. |
| 28 | # If it's a top-level, break out of the loop, otherwise |
| 29 | # look for its next sibling. |
| 30 | $cur = $parent; |
| 31 | last if ($cur->toplevel() == $cur); |
| 32 | $parent = $parent->parent(); |
| 33 | @children = $parent->FocusChildren(); |
| 34 | $i = lsearch(\@children,$cur); |
| 35 | } |
| 36 | if ($cur == $w || $cur->FocusOK) |
| 37 | { |
| 38 | $cur->tabFocus; |
| 39 | return; |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | # end of Tk::focusNext |
| 45 | 1; |