Re: Win32: Choosing bg-color for button widget
- From: Sean Mertiens <sean mertiens gmx de>
- To: gtk-app-devel-list gnome org
- Subject: Re: Win32: Choosing bg-color for button widget
- Date: Wed, 26 May 2004 20:56:36 +0200
All righ, guys. SOlved the problem myself.
Its just that temp can't be a pointer and its has to be passed like &temp.
Thx anyway.
Sean Mertiens wrote:
Hi,
well i want to make a pick-a-color-button with a button and a
ColorSelectionDialog Widget. The picked color should be the new
backgroud color of the button. Well the code itself works, but I still
get an error. These are parts of my code:
|GtkColorSelection *temp_color;|
// The callback for the color-button
|void color_button_clicked (GtkButton *button, gpointer user_data) {
GtkWidget *col_sel;
col_sel = gtk_color_selection_dialog_new ("Choose color");
g_signal_connect_swapped (GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG
(col_sel)->cancel_button),
"clicked",
G_CALLBACK (gtk_widget_destroy),
(gpointer) col_sel);
g_signal_connect (GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG
(col_sel)->ok_button),
"clicked",
G_CALLBACK (apply_color), button);
g_signal_connect (GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG
(col_sel)->colorsel),
"color_changed",
G_CALLBACK (update_temp_color), NULL);
gtk_widget_show (col_sel);
}
// apply color to button
void apply_color (GtkWidget *button, gpointer user_data) {
GdkColor *temp;
gtk_color_selection_get_current_color (temp_color, temp);
gtk_widget_modify_bg (GTK_WIDGET(user_data), GTK_STATE_NORMAL, temp);
}
// temp-color is global. It is used to store the actual color
void update_temp_color (GtkColorSelection *colorselection, gpointer
user_data) {
temp_color = colorselection;
}
|Well, sometimes it works quite fine, but mostly I get an error in
libglib-2.0.0.dll. It's just a simple Windows-DLL-Error, which contains
the following information:
---
AppName: favex.exe AppVer: 1.0.0.229 ModName: libglib-2.0-0.dll
ModVer: 2.2.3.0 Offset: 00007fe0
---
Does anyone know whats wrong? I'm really stuck with my program due to
that, so I would really appreciate your help. Thanks!
Greets,
Sean P. Mertiens
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]