RE: Button from an image (round Button)



That’s ok now, I have found something better to suit my needs for now.

 

I do a pixbuf animation on the keypad panel and take out the pointer location to change the frame content.

 

I think this wat I can do more than just display the buttons, but also animate them J

 

I appreciate the help Ravi. Your suggestion will help me in another aspect of my project.

 

Once again I appreciate the help on this.

 


From: gtk-list-bounces gnome org [mailto:gtk-list-bounces gnome org] On Behalf Of Gautam Ravi
Sent: Friday, February 29, 2008 1:12 PM
To: gtk-list gnome org
Subject: Re: Button from an image (round Button)

 

2008/2/29 Demetris Zavorotnichenko <fgcity4652 cytanet com cy>:

>>>>>gtk_widget_shape_combine_mask(GTK_WIDGET(button),mask, ...);

 

doesn't work like this with errors



 >>>>gdk_window_shape_combine_mask (button->window, mask, ...);

doesn't compile like this (passing argument 1 form incompatible pointer type)

Use  gdk_window_shape_combine_mask (GTK_WIDGET (button)->window, mask, ...);

 

 

 

I wanted to ask something else.

 

I want to create a keypad with 34 buttons

 

So I create the buttons in a loop.

 

And assign a callback function to the button

 

But I have only 1 callback function and 34 buttons so how do I know which button has been pressed in that callback ?

 

I have to create a separate callback function for each button ? and create the buttons separately? Or can I have an array of this buttons ? but then with an array I still have to have a separate callback ? please help out.

 


From: gtk-list-bounces gnome org [mailto:gtk-list-bounces gnome org] On Behalf Of Gautam Ravi
Sent: Friday, February 29, 2008 12:11 PM
To: gtk-list gnome org


Subject: Re: Button from an image (round Button)

 

2008/2/28 Demetris Zavorotnichenko <fgcity4652 cytanet com cy>:

I have done it like this: gtk_widget_shape_combine_mask(GTK_WIDGET(button->window),mask,0,0);

You are type-casting a GdkWindow to a GtkWidget, which you cannot do.
In this case its sufficient  if you do

gtk_widget_shape_combine_mask(GTK_WIDGET(button),mask, ...);
or
 gdk_window_shape_combine_mask (button->window, mask, ...);

 

 

It compiles

But when I run the application I get:

 

gtk_widget_shape_combine_mask: assertion 'GTK_IS_WIDGET (widget)' failed

 

What am I doing wrong?

 

How should the function look like ?

 

 


From: Gautam Ravi [mailto:gautam ravichandran gmail com]
Sent: Thursday, February 28, 2008 3:19 PM
To: Demetris Zavorotnichenko
Cc: gtk-list gnome org
Subject: Re: Button from an image (round Button)

 

Hi,

GtkButton has its own GdkWindow. It can be accessed like GTK_WIDGET (button)->window.

You can do the 
"shape_combine_mask" for the GtkButton's window also. See that "shape_combine_mask" is done when it is realized.

--
Regards
Gautam

2008/2/27 Demetris Zavorotnichenko <fgcity4652 cytanet com cy>:

Hi everyone.

 

Forgive me if my question is going to sound silly. But I'm new to GTK so I have to ask.

 

I want to create a button that would not be as a normal button, but with a shape I have from a PNG image(with transparency)

 

I have tried to do "shape_combine_mask" , created the masks, but it seems this works only for windows.

 

But I need a button with the shape from a PNG image and if I press it I would call a function so the button would have roll_over, or atleast "clicked" signals. Plus I want to make a bunch of them to create a keypad so I would have to move them and arrange them in a loop.

 

 

How could I do this ?

 

PLS help out.

 

Yours truly, Demetris Z.


_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list

 


_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list

 


_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list

 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]