gnope php gtk gui gnope.org  

GladeXml und set_events

 
Post new topic   Reply to topic    gnope.org Forum Index -> Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
syn



Joined: 12 May 2006
Posts: 46
Location: Hamburg

PostPosted: Fri May 12, 2006 12:49 pm    Post subject: GladeXml und set_events Reply with quote

Hi,

meine Applikation wird von GladeXml extended.

Nun würde ich gerne mouse-evens in meinem script nutzen. Leider bekomme ich eine Fehlermeldung, wenn ich events registrieren möchte

(your_file.php:1316): Gtk-CRITICAL **: gtk_widget_set_events: assertion `!GTK_WIDGET_REALIZED (widget)' failed[/code]

Das liegt wohl daran, das
parent::__construct('eccapp.glade');
schon
show()
aufruft.....

wie kann ich diesen fehler umgehen?

Code:
final class App extends GladeXml {
   public function __construct()
   {
      parent::__construct('eccapp.glade');
      // set event
      $this->btn_test->set_events(Gdk::BUTTON_PRESS_MASK);
   }

        __set () {//.....
}
}

--> error
(your_file.php:1316): Gtk-CRITICAL **: gtk_widget_set_events: assertion `!GTK_WIDGET_REALIZED (widget)' failed
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Fri May 12, 2006 12:53 pm    Post subject: Reply with quote

set_events funktioniert nur, wenn der widget noch nicht realized ist.
Die Reihenfolge ist so:
* erstellen (Konstruktor)
* realisieren (realize())
* anzeigen (show())

Wenn du show() machst, wird der Widget automatisch auch realisiert.

Was du machen kannst: Nimm add_events() anstatt vom set_events(), das funktioniert auch mit realisierten Widgets.
Back to top
syn



Joined: 12 May 2006
Posts: 46
Location: Hamburg

PostPosted: Fri May 12, 2006 1:44 pm    Post subject: Reply with quote

Danke für die Tips, werde ich nachher gleich mal ausprobieren.

Das problem ist, das ich das realize() und show() garnicht ausführe, sondern das das scheinbar schon durch den aufruf
parent::__construct('eccapp.glade'); (GladeXml)
passiert.

Ist dem so????
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Fri May 12, 2006 1:48 pm    Post subject: Reply with quote

Die Widgets werden von Glade realized, da hast du recht. Kann man nix machen.
Back to top
syn



Joined: 12 May 2006
Posts: 46
Location: Hamburg

PostPosted: Fri May 12, 2006 3:04 pm    Post subject: Reply with quote

add_events() ist genau das, was ich gesucht habe. Jetzt muß ich nur noch herausfinden, wie ich ein doppelklick in ein "select-cursor-row" machen kann und dann bin ich zuerst einmal glücklich.... Smile

Danke Christian.

Gruß,
Andreas
Back to top
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> Deutsches Forum (German) All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.