![]() |
2009-04-04
, 22:31
|
Posts: 1,950 |
Thanked: 1,174 times |
Joined on Jan 2008
@ Seattle, USA
|
#2
|
The Following User Says Thank You to GeraldKo For This Useful Post: | ||
![]() |
2009-04-04
, 22:56
|
|
Posts: 480 |
Thanked: 378 times |
Joined on Apr 2008
@ Chicago-ish
|
#3
|
if event.keyval == (UP keysym): if type(self.sw) == type(gtk.ScrolledWindow()): adj = self.sw.get_vadjustment() val = adj.get_value() adj.set_value(val+(adjustment)) self.sw.set_vadjustment(adj) # Not sure if this is necessary elif type(self.sw) == type(mokoui.FingerScroll()): pass #Not sure about this
The Following User Says Thank You to TrueJournals For This Useful Post: | ||
![]() |
2009-04-05
, 01:05
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#4
|
This is probably no help, but you know this?
http://www.internettablettalk.com/wi...e_Key_bindings
.
![]() |
2009-04-05
, 01:38
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#5
|
Not going to write any test code, so I haven't tried this at all... First I think you'll need to test for whether it's a ScrolledWindow or FingerScroll... For a ScrolledWindow, use gethadjustment(), then set the value of the returned gtk.Adjustment to some increment above or below its current value, then use sethadjustment() on the ScrolledWindow.
I hope that made sense. Not sure about the FingerScroll.
[edit]Here's some mostly-code:
Obviously, this leaves about some values, and I haven't looked into mokoui.FingerScrol. You would also want to test that mokoui is imported before you just call type(mokoui.FingerScroll())Code:if event.keyval == (UP keysym): if type(self.sw) == type(gtk.ScrolledWindow()): adj = self.sw.get_vadjustment() val = adj.get_value() adj.set_value(val+(adjustment)) self.sw.set_vadjustment(adj) # Not sure if this is necessary elif type(self.sw) == type(mokoui.FingerScroll()): pass #Not sure about this
[edit2]Looking at mokoui... I believe the code would be the same as the scrolledwindow code, so no need to type test. Again, I haven't tried this at all (I've never even dealt with mokoui before).
adj.set_page_increment(gtk.SCROLL_PAGES)
![]() |
2009-04-05
, 02:09
|
|
Posts: 480 |
Thanked: 378 times |
Joined on Apr 2008
@ Chicago-ish
|
#6
|
adj.page_incrment = gtk.SCROLL_PAGES
![]() |
2009-04-06
, 00:36
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#7
|
if event.keyval == gtk.keysyms.Up: adj = self.sw.get_vadjustment() adj.page_increment = gtk.SCROLL_PAGES val = adj.get_value() adj.set_value(val+(gtk.SCROLL_PAGE)) self.sw.set_vadjustment(adj)
![]() |
2009-04-06
, 01:17
|
|
Posts: 2,427 |
Thanked: 2,986 times |
Joined on Dec 2007
|
#8
|
Code:if event.keyval == gtk.keysyms.Up: adj = self.sw.get_vadjustment() adj.page_increment = gtk.SCROLL_PAGES val = adj.get_value() adj.set_value(val+(gtk.SCROLL_PAGE)) self.sw.set_vadjustment(adj)
![]() |
2009-04-06
, 01:46
|
|
Posts: 2,427 |
Thanked: 2,986 times |
Joined on Dec 2007
|
#9
|
def pageup(self, sw): newval = sw.props.vadjustment.value - sw.props.vadjustment.page_size if newval < sw.props.vadjustment.lower: newval = sw.props.vadjustment.lower sw.props.vadjustment.value = newval
The Following User Says Thank You to daperl For This Useful Post: | ||
![]() |
2009-04-06
, 01:55
|
|
Posts: 2,427 |
Thanked: 2,986 times |
Joined on Dec 2007
|
#10
|
def pagedown(self, sw): newval = sw.props.vadjustment.value + sw.props.vadjustment.page_size max = sw.props.vadjustment.upper - sw.props.vadjustment.page_size if newval > max: newval = max sw.props.vadjustment.value = newval
Here is the important part of the code:
I know I need to add if statements to catch the Up/Down key buttons, but how to you scroll a textview and/or scrolledwindow?
The textview is self.textview and scrolledwindow is self.sw (to complicate matters, the scrolledwindow can either be a gtk.ScrolledWindow or mokoui.FingerScroll object).
Any help is appreciated.