Buchempfehlung
Visual Basic 6 Kochbuch
Visual Basic 6 Kochbuch
Viele praktische Tipps zum Programmieren mit Visual Basic 6, die sich oft auch auf FB übertragen lassen. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

GTK Pointer Problem - 1

Uploader:Mitgliedrieselkalk
Datum/Zeit:03.08.2010 14:49:15

#Include once "gtk/gtk.bi"
gtk_set_locale()
#define NULL 0

gtk_init (0, 0)


Type t_mte_od
    As gint tooltips                                                        '- Tooltips EIN/AUS
    As gchar Ptr left_margin                                        '- Breite des linken Randes
    As gchar Ptr right_margin                                       '- Breite des rechten Randes
End Type

Type t_mte_o
    As t_mte_od Ptr p_daten
  As GtkWidget Ptr p_entry_rand_links
End Type


'- Option Variablen anlegen
  Dim mte_od As t_mte_od
  Dim p_mte_od As t_mte_od Ptr

'- Option Variablen Wert zuweisen
  p_mte_od = @mte_od
    p_mte_od->tooltips = TRUE                                        '- Tooltips EIN/AUS
    p_mte_od->left_margin =  @"10"                               '- Breite des linken Randes
    p_mte_od->right_margin = @"10"                           '- Breite des rechten Randes

'----------------------
'- Was läuft hier falsch mit den UDT
Sub mte_on_menuitem_option_okbutton_activate Cdecl (ByVal widget as GtkWidget ptr, ByRef p_ud as t_mte_o Ptr)
'Sub mte_on_menuitem_option_okbutton_activate Cdecl (ByVal widget as GtkWidget ptr, ByVal p_ud as t_mte_o Ptr)
  Print "++++++++++++++++++++++++++++++++++++"
  Print "okbutton"
  Print "------------------------------------"
'  g_print ("%s", p_ud->p_daten->left_margin)
'  Print ""
  gtk_entry_set_text (GTK_ENTRY (p_ud->p_entry_rand_links), ("999"))
End Sub

Sub mte_on_menuitem_option_chancelbutton_activate Cdecl (ByVal widget as GtkWidget ptr, ByVal p_ud as t_mte_od Ptr)
  Print "************************************"
  Print "chancelbutton"
  Print "------------------------------------"
  g_print ("%s", p_ud->left_margin)
  Print ""

End Sub

Function mte_ShowOptionDialog (ByRef p_data As t_mte_od Ptr) As gint
  Dim As GtkWidget Ptr p_window_1
  Dim As GtkWidget Ptr p_vbox_1
  Dim As GtkWidget Ptr p_cancelbutton_1
  Dim As GtkWidget Ptr p_okbutton_1

  mte_ShowOptionDialog = TRUE

'- Pointer für Dateneingabe Widget's anlegen
  Dim mte_o As t_mte_o
  Dim p_mte_o As t_mte_o Ptr

  p_mte_o = @mte_o

'- Daten übernahme  in den Widget's Pointer
  p_mte_o->p_daten = p_data


  p_window_1 = gtk_window_new (GTK_WINDOW_TOPLEVEL)
  gtk_widget_set_name (p_window_1, "p_window_1")
  gtk_window_set_title (GTK_WINDOW (p_window_1), ("Test"))
  gtk_window_set_position (GTK_WINDOW (p_window_1), GTK_WIN_POS_CENTER)
  gtk_window_resize (GTK_WINDOW (p_window_1), 500, 300)


  p_vbox_1 = gtk_vbox_new (FALSE, 0)
  gtk_container_add (GTK_CONTAINER (p_window_1), p_vbox_1)
  gtk_widget_set_name (p_vbox_1, "p_vbox_1")
  gtk_widget_show (p_vbox_1)

'- Eingabe Feld, welches beim drücken des OK Button verändert werden soll
  p_mte_o->p_entry_rand_links = gtk_entry_new_with_max_length (6)
  gtk_widget_set_name (p_mte_o->p_entry_rand_links, "p_entry_rand_links")
  gtk_box_pack_start (GTK_BOX (p_vbox_1), p_mte_o->p_entry_rand_links, FALSE, FALSE, NULL)

  gtk_widget_set_usize (p_mte_o->p_entry_rand_links, 50, 20)
  gtk_entry_set_text (GTK_ENTRY (p_mte_o->p_entry_rand_links), ("10"))
  gtk_entry_set_invisible_char (GTK_ENTRY (p_mte_o->p_entry_rand_links), 9679)




'- Dialog action Button
  p_cancelbutton_1 = gtk_button_new_from_stock ("gtk-cancel")
  gtk_widget_set_name (p_cancelbutton_1, "p_cancelbutton_1")
  gtk_widget_show (p_cancelbutton_1)
  gtk_box_pack_end (GTK_BOX (p_vbox_1), p_cancelbutton_1, FALSE, FALSE, NULL)
  GTK_WIDGET_SET_FLAGS (p_cancelbutton_1, GTK_CAN_DEFAULT)

  p_okbutton_1 = gtk_button_new_from_stock ("gtk-ok")
  gtk_widget_set_name (p_okbutton_1, "p_okbutton_1")
  gtk_widget_show (p_okbutton_1)
  gtk_box_pack_end (GTK_BOX (p_vbox_1), p_okbutton_1, FALSE, FALSE, NULL)
  GTK_WIDGET_SET_FLAGS (p_okbutton_1, GTK_CAN_DEFAULT)

'- Signale
  gtk_signal_connect (GTK_OBJECT (p_okbutton_1), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_option_okbutton_activate), p_mte_o)

  gtk_signal_connect (GTK_OBJECT (p_cancelbutton_1), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_option_chancelbutton_activate), p_mte_o->p_daten)

  gtk_widget_show_all (p_window_1)

End Function

  mte_ShowOptionDialog (p_mte_od)

gtk_main()