down key and clist

From: Date: Fri, 04 Aug 2000 15:53:37 +0000
Subject: down key and clist
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-2780@lists.php.net to get a copy of this message
greetings, this question is coming from a real newbie and i'm kinda thinking someone already has a genaric function to cover what it is i need. i have a problem with clist, the scroll bar thats attached to the clist works perfect, the problem is with the arrow keys, check out the program below (which i did'nt write), say i create a clist with the months in it. then the clist box is not big enough to show all the months at the same time. if i use the scroll bar everything works fine. if i use the down arrow key everythings cool until i reach the last visiable month, then when i press the down arrow key one more time and the clist should scroll something weird happens, nothing scrolls. instead my cursor disappears out of the clist. surely i'm not the first person to see this and someone has created a function to handle keyboard events in this situation. can anyone help me ?? <?php /* $Id: list.php,v 1.9 2002/11/25 18:22:05 fmk Exp $ */ if (!class_exists('gtk')) { if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') dl('php_gtk.dll'); else dl('php_gtk.so'); } /* * Called when delete-event happens. Returns false to indicate that the event * should proceed. */ function delete_event() { return false; } /* * Create a new top-level window and connect the signals to the appropriate * functions. Note that all constructors must be assigned by reference. */ $window = &new GtkWindow(); $window->connect_object('destroy', array('gtk', 'main_quit')); $window->connect('delete-event', 'delete_event'); /* * Create a button and connect its 'clicked' signal to destroy() function. */ $button = &new GtkButton('Close'); $button->connect_object('clicked', array('gtk', 'main_quit')); /* * Create a vertical layout box. */ $box = &new GtkVBox(false, 10); $box->set_border_width(10); /* * Create a list widget and populate it with month names. */ $list = &new GtkList(); $list->set_selection_mode(GTK_SELECTION_BROWSE); foreach (range(1, 12) as $month_num) $items[] = &new GtkListItem(strftime('%B', mktime(0, 0, 0, $month_num))); $list->append_items($items); /* * Create a scrolled window and add the list widget to it - this provides * automatic scrollbars. */ $scrolled_window = &new GtkScrolledWindow(); $scrolled_window->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); $scrolled_window->add_with_viewport($list); /* * Add scrolled window and button to the vertical layout box. */ $box->pack_start($scrolled_window); $box->pack_start($button, false); /* * Add layout box to the window, set window attributes and show everything. */ $window->add($box); $window->set_title('PHP Rules!'); $window->set_name('MainWindow'); $window->set_usize(150, 200); $window->show_all(); /* Run the main loop. */ Gtk::main(); ?>

« previous php.gtk.general (#2780) next »