6
procedure destroy(widget : pGtkWidget ; data: pgpointer ); cdecl;
12
Inside : PChar ='Mouse is over label';
13
OutSide : PChar ='Mouse is not over label';
16
window, button1,Button2, Alabel,stackbox : PGtkWidget;
17
buttonstyle : pgtkstyle;
20
Procedure ChangeLabel(P : PGtkWidget;
21
Event : PGdkEventCrossing;
22
Var Data : Boolean);cdecl;
26
gtk_label_set_text(PGTKLABEL(ALabel),Inside)
28
gtk_label_set_text(PGTKLABEL(ALabel),Outside);
33
gtk_init (@argc, @argv);
34
window := gtk_window_new (GTK_WINDOW_TOPLEVEL);
35
stackbox:=gtk_vbox_new(TRUE,10);
36
button1 := gtk_button_new_with_label(strnew('Move mouse over button'));
37
buttonstyle := gtk_style_copy(gtk_widget_get_style(Button1));
38
With ButtonStyle^.bg[GTK_STATE_PRELIGHT] do
45
gtk_widget_set_style(button1,buttonstyle);
46
button2 := gtk_button_new;
47
ALabel:=gtk_label_new(Outside);
48
gtk_container_add(GTK_CONTAINER(button2),ALAbel);
49
gtk_box_pack_start(GTK_BOX(stackbox),button1,TRUE,TRUE,0);
50
gtk_box_pack_start(GTK_BOX(stackbox),button2,TRUE,TRUE,0);
51
gtk_container_set_border_width(GTK_CONTAINER(Window),5);
52
gtk_container_add(GTK_Container(window),stackbox);
53
gtk_signal_connect(PGTKOBJECT (window), 'destroy',
54
GTK_SIGNAL_FUNC (@destroy), NULL);
56
gtk_signal_connect(PGTKOBJECT(button1),'enter_notify_event',
57
GTK_SIGNAL_FUNC (@ChangeLabel), @OverButton);
58
gtk_signal_connect(PGTKOBJECT(button1),'leave_notify_event',
59
GTK_SIGNAL_FUNC (@ChangeLabel), @OverButton);
60
gtk_widget_show_all (window);