Re: different callbacks for left and right button using "button_press_event"
- From: "Ignacio" <inodal teleline es>
- To: "Paul Davis" <pbd Op Net>
- Cc: "GTK-List" <gtk-list gnome org>
- Subject: Re: different callbacks for left and right button using "button_press_event"
- Date: Sat, 20 Oct 2001 15:48:35 +0100
----- Original Message -----
From: "Paul Davis" <pbd Op Net>
To: "Ignacio" <inodal teleline es>
Cc: "GTK-List" <gtk-list gnome org>
Sent: Saturday, October 20, 2001 3:37 PM
Subject: Re: different callbacks for left and right button using
"button_press_event"
> >void ParameterButton::CB_Button(GtkWidget* widget, GdkEventButton* event,
> >gpointer cd)
> >{
> > ParameterButton * pb = (ParameterButton *) cd;
> > switch (event->button) {
> > case 1:
> > g_print("CB_Button, left button\n");
> > if(pb->_callback != NULL) {
> > void (*pf) (gpointer) = (void (*) (gpointer)) pb->_callback;
> > pf(pb->_calldata);
>
> without knowing what the thing you set pb->_callback to is, there is no
> way of knowing whether this is a legal statement. it doesn't seem
> impossible from your design that you've attached a member function to
> pb->_callback, for example. this cannot work. but like i said, i don't
> know what you're trying to call.
>
> --p
>
It's not a member function, I know that cannot work. It's just a function
declared in my main.cpp,
(by the other hand this function calls member functions, but this is
allowed, isn't it?).
---it looks something like this---
#include <gtk/gtk.h>
#include "ParameterTypes.hpp"
#include "ParamWindow.hpp"
#include "ParamColor.hpp"
void cb_xpm_button(GtkWidget *widget, gpointer pdata)
{
ParameterFloat * data = (ParameterFloat *) pdata;
if (data->Visible()) {
data->FixVisible(FALSE);
data->UnManage();
} else {
data->FixVisible(TRUE);
data->Manage();
}
}
int main (int argc, char *argv[])
{
...
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]