GTK + sockets help

This is a discussion on GTK + sockets help within the C Programming forums, part of the General Programming Boards category; i have decided to build a GUI for a synchronous server/client i wrote. So far i have a send button ...

  1. #1
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302

    GTK + sockets help

    i have decided to build a GUI for a synchronous server/client i wrote. So far i have a send button and a text box. I am able to place the send button where i want by creating tables. When i try and place the text box and expand it, it will not expand for some reason.


    Here's a pic.

    Name:  cboard_GTK.png
Views: 212
Size:  32.1 KB

    i want to expand the text box and have it take the whole upper half of the window.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <gtk/gtk.h>
    
     static void destroy_event(GtkWidget *widget, gpointer data)
      {
        gtk_main_quit();
      }
    
      static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
      {
        gtk_main_quit();
        return FALSE;
      }
    
    int main (int argc, char *argv[])
    {
      GtkWidget *window;
      GtkWidget *entry;
      GtkWidget *table;
      GtkWidget * button_send;
      //GtkWidget *button_connect;
    
    
      gtk_init(&argc, &argv);
    
      window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
      gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
      gtk_window_set_default_size(GTK_WINDOW(window), 450, 400);
      gtk_window_set_title(GTK_WINDOW(window), "menu");
      gtk_widget_show(window);
    
      table = gtk_table_new (1, 3, TRUE);
      gtk_container_add(GTK_CONTAINER (window), table);
      gtk_widget_show(table);
      
      /*button_connect = gtk_button_new_with_label("Connect");
      gtk_container_add(GTK_CONTAINER(window), button_connect);
      gtk_misc_set_alignment(GTK_MISC(button_connect), 3, 0);
      gtk_table_attach_defaults (GTK_TABLE(table), button_connect, 0, 1, 2, 3);
      //gtk_misc_set_alignment(GTK_MISC(button_connect), 1, 0);
      //gtk_container_set_border_width(GTK_CONTAINER(button_connect), 2);
      gtk_widget_show(button_connect);*/
    
      button_send = gtk_button_new_with_label("Send");
      gtk_container_add(GTK_CONTAINER(window), button_send);
      //gtk_misc_set_alignment(GTK_MISC(button_send), 3, 0);
      gtk_table_attach_defaults(GTK_TABLE(table), button_send, 0, 4, 2, 3);
      gtk_widget_show(button_send);
    
      entry = gtk_entry_new();
      gtk_container_add(GTK_CONTAINER(window), entry);
      gtk_table_attach_defaults(GTK_TABLE(table), entry, 0, 4, 0, 2);
      gtk_widget_show(entry);
    
      g_signal_connect_swapped(G_OBJECT(window), "destroy-event",
          G_CALLBACK(destroy_event), NULL);
    
      g_signal_connect_swapped(G_OBJECT(window), "delete-event",
          G_CALLBACK(delete_event), NULL);
    
      gtk_main ();
      return 0;
    }
    ideas?
    Last edited by Annonymous; 04-21-2012 at 06:52 PM.

  2. #2
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302
    Ill just use hbox to pack, instead of tables.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sockets tutorial, datagram sockets example not working for me
    By caesius in forum Networking/Device Communication
    Replies: 14
    Last Post: 12-26-2009, 02:40 PM
  2. [Help] Best way of using sockets
    By lautarox in forum C Programming
    Replies: 7
    Last Post: 09-04-2008, 03:14 PM
  3. raw sockets?
    By Devil Panther in forum Networking/Device Communication
    Replies: 2
    Last Post: 11-01-2003, 12:23 AM
  4. Sockets again :)
    By G'n'R in forum Networking/Device Communication
    Replies: 4
    Last Post: 09-23-2003, 10:27 AM
  5. Sockets....
    By G'n'R in forum Networking/Device Communication
    Replies: 15
    Last Post: 09-19-2003, 04:14 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21