Some simple GTK questions



Hallo, I have again some simple gnome questions:

* I found a function to create a combo box, and I even managed to display it.
But I did not find a function to get the selected item.
how can I do this. the code is as follows:


MyCombo::MyCombo(MyGtk *parent,int n,char *selections[])
{
 GList *items=(GList *) NULL;
 int i;
 win = gtk_combo_new();
 for(i=0;i<n;i++)
 {
  items=g_list_append(items,(void *)selections[i]);
 } 
 gtk_combo_set_popdown_strings(GTK_COMBO(win),items);
 parent_child(parent, win);
}

MyCombo::~MyCombo()
{
}

char *MyCombo::text(void)
{
        return "A3";
//      return gtk_entry_get_text(((GtkEntry *)win)->entry);
}
----------------------
*Additionally I created a class with the GtkFileSelection
 here is the code

MyFileSelection::MyFileSelection(char *title,char *file,char
*pattern,funcptr(func))
{
 win = gtk_file_selection_new(title);
 gtk_file_selection_set_filename(GTK_FILE_SELECTION(win),file);
 gtk_window_set_modal(GTK_WINDOW(win),TRUE);
 if(func != NULL)
gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(win)->ok_button),"clicked",GTK_
SIGNAL_FUNC(func),gtk_f
ile_selection_get_filename(GTK_FILE_SELECTION(win)));
 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(win)->ok_button),"clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_O
BJECT(win));

gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(win)->cancel_button),"clicked",
 GTK_SIGNAL_FUNC (gtk_widget_destroy), G
TK_OBJECT(win));
//  gtk_file_selection_complete(GTK_FILE_SELECTION(win),pattern);
}

MyFileSelection::~MyFileSelection()
{
}

void MyFileSelection::run(void)
{
        gtk_widget_show(win);
}

When I click OK or cancel, the button is destroyed instead of the complete
window. It looks funny but it isn't and I dont have an idea as 4 definity give
the file selector window as the 4th of the gtk_signal_connect function 
not the button.

Does anybody have an idea ?
What is the right method to get the filename delivered by GtkFileSelector
because once the data is freed when this window is closed, the data is not
avaiable anymore.


This is it. Thanx for your attention

Guenther Sohler

NewLogic Technologies AG 
Millennium Park 6
A-6890 Lustenau
                                           Phone: +43-5577-62000-507
E-Mail: guenther sohler newlogic com       Fax:   +43-5577-62000-988




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]