GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Oct 24, 2014 7:46 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: move window
PostPosted: Sat Oct 06, 2007 6:57 am 
Offline
GTK+ Guru

Joined: Thu Nov 16, 2006 5:08 am
Posts: 259
Location: INDIA
hi all
we know that click on the tittlebar we can move the window, but
is there any widget(window) that is movable(means we have to click the mouse button in the middle of the window , and move the window)

am using gtk c.

please help me with an example

thank you in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 10, 2007 7:49 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
Technically, you can do this with any widget by using mouse press events and motion events. Could you give an example of what you want to do? That will make it easier to point you in the right direction.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 11, 2007 4:21 am 
Offline
GTK+ Guru

Joined: Thu Nov 16, 2006 5:08 am
Posts: 259
Location: INDIA
openldev wrote:
Technically, you can do this with any widget by using mouse press events and motion events. Could you give an example of what you want to do? That will make it easier to point you in the right direction.


Code:
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>


/* prototypes */
void
on_button_press (GtkWidget *widget, GdkEventKey *event, gpointer user_data);


int main (int argc, char *argv[])
{
    GtkWidget *window;
  GtkWidget *eventbox;

    gtk_init (&argc, &argv);
   
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  eventbox = gtk_event_box_new ();
  gtk_widget_show (eventbox);
  gtk_container_add (GTK_CONTAINER (window), eventbox);

  gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_TOOLBAR);
//gtk_window_set_opacity (window,0);
   
    /* connect signal callbacks */
    g_signal_connect (G_OBJECT (window), "destroy",
                    G_CALLBACK (gtk_main_quit), NULL);
          gtk_signal_connect(GTK_OBJECT(eventbox), "button_press_event",
           GTK_SIGNAL_FUNC(on_button_press), NULL);

                   
    gtk_widget_show_all (window);
   
    gtk_main ();

    return 0;
}

void
on_button_press (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
//event->keyval == GDK_Alt_L;
g_print("hiiiiiiiiiiiii \n");

}

and compiled
gcc -Wall -g `pkg-config --cflags --libs gtk+-2.0` -o pointer pointer.c

but not getting the window movement...
correct the code

please help me with this code

thank you inadvance


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group