php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49907 PHP Gtk2 Widget can_default is undefined
Submitted: 2009-10-17 08:05 UTC Modified: 2009-10-26 01:00 UTC
From: chezmmd at gmail dot com Assigned:
Status: No Feedback Package: PHP-GTK related
PHP Version: 5.2.11 OS: WinXP
Private report: No CVE-ID: None
 [2009-10-17 08:05 UTC] chezmmd at gmail dot com
Description:
------------
Unable to get GtkEntry to have focus after user selects a row in GtkTreeView on same screen w/o a grab_default.  Widget->grab_default causes GtkCritical error w/o can_default (php.exe:2020 Gtk-CRITICAL gtk_widget_grab_default: assertion 'GTK_WIDGET_CAN_DEFAULT'(widget) failed.  Widget->can_default causes PHP fatal error and crash.

Reproduce code:
---------------
<?php 
$button1 = new GtkButton('Default Test');
$button2 = new GtkButton('Extra Button');
$button2->can_default(TRUE);

$vbox = new GtkVBox;
$vbox->pack_start($button1, FALSE, FALSE);
$vbox->pack_start($button2, FALSE, FALSE);
 
$window = new GtkWindow;
$window->connect_simple('destroy', array('gtk', 'main_quit'));
$window->set_default_size(120,120);
$window->add($vbox);
$window->show_all();

$button2->grab_focus();
$button2->grab_default();

Gtk::main();

 ?> 


Expected result:
----------------
Button has keyboard focus and no critical error for can_default property.

Actual result:
--------------
application crash.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-18 14:08 UTC] auroraeosrose@php.net
Is this with 2.0.1 or an SVN version of PHP-GTK?

Also what version of gtk is on your system?  If you're using gtk 2.16 or 2.18 I HIGHLY recommend you upgrade to an svn version of php-gtk - all the can-default stuff has now been wrapped properly (so you set can-default to true and then grab)

Thanks!
 [2009-10-26 01:00 UTC] php-gtk-dev at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 14:01:29 2024 UTC