News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.

Post Reply  Post Thread 
Making scroll ignore pageup/pagedown/home/end?
Author Message
Senior Member

Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
Making scroll ignore pageup/pagedown/home/end?

I've been trying to work out a way to navigate Fl_Browser using keyboard only, and running into a problem with the scroll automatically grabbing certain keystrokes and ignoring actions specifically associated with those events. In Fl_Hold_Browser using Up and Down to move the section up and down one line at a time works as expected without modification. However, PageUp, PageDown, Home, and End will only move the scroll...the browser selection doesn't change, so you still have to click to select.

I tried setting up a global menu bar to detect these events, and specifically move the selection accordingly. It works only if the browser does not have focus. I thought a global menu was supposed to work no matter what widget has focus, but there seems to be some hard-coded events associated with some widgets.

Any ideas how to accomplish this, other than by using non-standard keys to do the navigation? It works fine if I use keys not generally associated with navigation, but PageUp/PageDown are so common it seems really weird to use anything else.

function nav_browser()
if Fl:event_key() == fltk.FL_Home then
elseif Fl:event_key() == fltk.FL_End then
elseif Fl:event_key() == fltk.FL_Page_Up then
elseif Fl:event_key() == fltk.FL_Page_Down then
-- can't figure this one yet
-- why can you use topline() without an argument, but not bottomline()?

win = fltk:Fl_Window(400,500,"browser nav test")
browser = fltk:Fl_Hold_Browser(0,0,400,500)
browser_ctrl = fltk:Fl_Menu_Bar(400,500,10,10)
browser_ctrl:add("home", fltk.FL_Home, nav_browser)
browser_ctrl:add("end", fltk.FL_End, nav_browser)
browser_ctrl:add("up", fltk.FL_Page_Up, nav_browser)
browser_ctrl:add("down", fltk.FL_Page_Down, nav_browser)

for line = 1,100 do browser:add("Line "..line) end


05-17-2011 12:35 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: