fb:porticula NoPaste
GTK - Button im Fensterfrei plazieren - fixed_1
Uploader: | rieselkalk |
Datum/Zeit: | 22.04.2010 02:21:09 |
'- rieselkalk 2010
'- fixed_1.bas
#include once "gtk/gtk.bi"
Dim Shared Schalter As Integer
Declare Sub callback cdecl (byval widget as GtkWidget ptr, byval user_data as gpointer)
gtk_init (0, 0)
Schalter = 0
dim as GtkWidget ptr win_1 = gtk_window_new (GTK_WINDOW_TOPLEVEL)
gtk_window_set_title (GTK_WINDOW (win_1), "Test fixed 1")
gtk_window_move (GTK_WINDOW (win_1), 300, 300)
gtk_window_resize (GTK_WINDOW (win_1), 300, 300)
dim Shared As GtkWidget ptr button
button = gtk_button_new_with_label("Druecke mich!")
g_signal_connect(GTK_OBJECT(button),"clicked",G_CALLBACK(@callback),0)
Dim Shared As GtkWidget Ptr fox_1
fox_1 = gtk_fixed_new ()
gtk_container_add (GTK_CONTAINER(win_1), fox_1)
gtk_fixed_put (GTK_FIXED(fox_1), button, 10, 10)
gtk_widget_show_all (win_1)
gtk_widget_set_size_request (GTK_WIDGET(button), 200, 200)
gtk_main()
sub callback cdecl (byval widget as GtkWidget ptr, byval user_data as gpointer)
Select Case Schalter
Case 0
gtk_fixed_move (GTK_FIXED(fox_1), GTK_WIDGET(button), 10, 10)
gtk_widget_set_size_request (GTK_WIDGET(button), 60, 40)
Schalter = 1
Case 1
gtk_fixed_move (GTK_FIXED(fox_1), GTK_WIDGET(button), 230, 250)
gtk_widget_set_size_request (GTK_WIDGET(button), 60, 40)
Schalter = 2
Case 2
gtk_fixed_move (GTK_FIXED(fox_1), GTK_WIDGET(button), 10, 10)
gtk_widget_set_size_request (GTK_WIDGET(button), 200, 200)
Schalter = 3
Case 3
gtk_fixed_move (GTK_FIXED(fox_1), GTK_WIDGET(button), 250, 10)
gtk_widget_set_size_request (GTK_WIDGET(button), 40, 60)
Schalter = 0
End Select
print "Button geklickt! " + Str$(Schalter)
end sub