Re: [gtk-list] gtk-- listitem/button-press signal question
- From: afo tesis de (Andre Fornacon)
- To: gtk-list redhat com
- Subject: Re: [gtk-list] gtk-- listitem/button-press signal question
- Date: Tue, 20 Jan 1998 10:02:10 +0100 (MET)
>
>I've got a window with list in it and I want one of the
>Window's member functions to be called when an item in the
>list is double clicked. I've added a callback function with
>what looks like the right signature to my window class, but
>I can't figure out how to get it connected to the button event.
>The compiler does not like my connect() call one bit!
>
>Below is a rough approximation of my current code: can anybody
>tell me what I am doing wrong? Am I even on the right track
>with this?
>
>class MyWindow : public Gtk_Window {
>...
>private:
> Gtk_List* mylist;
>public:
> int onButtonPress(gint i, Gtk_Widget w,GdkEventButton* evt) {
> // Check event type to see if it was a double click
> }
> MyWindow() {
> ...
> Gtk_ListItem* item1 = new Gtk_ListItem("Item1");
> mylist->add(item1);
> connect( item1->button_press_event, *this,
> &Gfm_Window::onButtonPress );
> ...
> }
>...
>}
>
hi david,
the following works for me:
class Test
{
public:
Test();
protected:
void ListCB(GdkEventButton *);
private:
Gtk_List *_list;
};
Test::Test()
{
...
_list=new Gtk_List();
connect(_list,"button_press_event",this,ListCB);
...
}
void Test::ListCB(GdkEventButton *e)
{
...
}
--
Andre Fornacon
mail: A.Fornacon@tesis.de
phone: 49 89 74 73 77 52
TESIS GmbH Munic, Germany
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]