Re: [gtk-list] Tab completion in Combo box ?



Preben Randhol wrote:
> 
> Looking at the Combo-box code (1.2.3) I noticed that TAB completion is
> implemented. I want to use this feature in a program so I tried to
> press tab (after having written the first part of one of the
> items). The problem is that the focus now was moved from the
> entry-widget (in the combo) to the next widget in the app. Is it
> possible to override the focus switching for this widget only?
> 
> Any hints much appreciated

Hope these bits of code help (I snipped them from the app I'm developing
atm). If this is not clear, I can send you the whole source.


gtk_signal_connect(GTK_OBJECT(GTK_COMBO(ComboBox)->entry),
"key_press_event", GTK_SIGNAL_FUNC(comboKeyPress), NULL);

gboolean comboKeyPress(GtkWidget *widget, GdkEventKey *event, gpointer
user_data)
{

	switch(event->keyval)
	{
		case GDK_Tab:
			<< implement your tab completion functions - probably using glib
g_completion functions>>
			break;
		default:
			return FALSE;
			break;
	}
	gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "key_press_event");
	return TRUE;
}


-- 
Geert Bevin - gbevin@thunderstorms.org
Montenegrostraat 11      1060 Brussels
BELGIUM                   0477/302.599
--------------------------------------
>>  Idealists have to communicate  <<



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