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 

move window

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
ramesh
GTK+ Guru


Joined: 16 Nov 2006
Posts: 135
Location: INDIA

PostPosted: Sat Oct 06, 2007 6:57 am    Post subject: move window Reply with quote

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
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 386
Location: Fairfax, Virginia

PostPosted: Wed Oct 10, 2007 7:49 pm    Post subject: Reply with quote

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.
Back to top
ramesh
GTK+ Guru


Joined: 16 Nov 2006
Posts: 135
Location: INDIA

PostPosted: Thu Oct 11, 2007 4:21 am    Post subject: Reply with quote

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: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

#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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming 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