GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hello All

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Example Code
Author Message
marine



Joined: 14 Jul 2008
Posts: 1

PostPosted: Sat Jul 19, 2008 7:48 am    Post subject: Hello All Reply with quote

Hi everyone. My name is Ray, from Utica, NY. I will be visiting Poland soon, and I am hoping to meet my Polish relatives. I also hope some people from here may help me in contacting my relatives before my visit. Thanks and looking forward to meeting some great people on here!
Back to top
gedward
Familiar Face


Joined: 28 Jun 2008
Posts: 24
Location: Chicago, IL

PostPosted: Sat Jul 19, 2008 6:43 pm    Post subject: Corrections for offtopic dialog window message generator Reply with quote

I tried it, but I got

error: syntax error before "everyone"

so I commented out the offending line (after several failed attempts to correct it), but then I got

undefined reference to `main'

After poring over it for several more hours, I believe I identified the problem. It's a little too complex to properly describe in a single post, however; I took the liberty of putting together the following patch which I hope you'll consider:

1c1,49
< Hi everyone. My name is Ray, from Utica, NY. I will be visiting Poland soon, and I am hoping to meet my Polish relatives. I also hope some people from here may help me in contacting my relatives before my visit. Thanks and looking forward to meeting some great people on here!
---
> #include <stdlib.h>
> #include <gtk/gtk.h>
>
> static void helloWorld (GtkWidget *wid, GtkWidget *win)
> {
> GtkWidget *dialog = NULL;
>
> dialog = gtk_message_dialog_new (GTK_WINDOW (win), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "Hi everyone. My name is Ray, from Utica, NY. I will be visiting Poland soon, and I am hoping to meet my Polish relatives. I also hope some people from here may help me in contacting my relatives before my visit. Thanks and looking forward to meeting some great people on here!");
> gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
> gtk_dialog_run (GTK_DIALOG (dialog));
> gtk_widget_destroy (dialog);
> }
>
> int main (int argc, char *argv[])
> {
> GtkWidget *button = NULL;
> GtkWidget *win = NULL;
> GtkWidget *vbox = NULL;
>
> /* Initialize GTK+ */
> g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
> gtk_init (&argc, &argv);
> g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);
>
> /* Create the main window */
> win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> gtk_container_set_border_width (GTK_CONTAINER (win), 8);
> gtk_window_set_title (GTK_WINDOW (win), "Hello World");
> gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);
> gtk_widget_realize (win);
> g_signal_connect (win, "destroy", gtk_main_quit, NULL);
>
> /* Create a vertical box with buttons */
> vbox = gtk_vbox_new (TRUE, 6);
> gtk_container_add (GTK_CONTAINER (win), vbox);
>
> button = gtk_button_new_from_stock (GTK_STOCK_DIALOG_INFO);
> g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (helloWorld), (gpointer) win);
> gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
>
> button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
> g_signal_connect (button, "clicked", gtk_main_quit, NULL);
> gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
>
> /* Enter the main loop */
> gtk_widget_show_all (win);
> gtk_main ();
> return 0;
> }

It runs on my system fine, so I'm pretty sure it's okay. But please let me know if I introduced any glaring errors or took your original version in the wrong direction, etc.


Last edited by gedward on Sat Jul 19, 2008 7:52 pm; edited 1 time in total
Back to top
Vadi
GTK+ Geek


Joined: 28 May 2008
Posts: 68

PostPosted: Sat Jul 19, 2008 7:12 pm    Post subject: Reply with quote

:) good chuckle there. We should keep this spam post.
Back to top
gedward
Familiar Face


Joined: 28 Jun 2008
Posts: 24
Location: Chicago, IL

PostPosted: Sat Jul 19, 2008 7:46 pm    Post subject: Reply with quote

Spam? Nonsense, spambots can't code. What about that was s... Boy, is my face red right now. :lol:
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Example Code All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP