Re: gtkentry grab-focus



For those interested, here's a way to get the desired result. The
source of gtkentry.c shows that if the entry receives a click, it
resets the selection to the current position of the cursor. Hence the
following button-press-event callback works:

static gboolean event_cb(GtkWidget*w,GdkEvent*event,gpointer p)
{
  if(!GTK_WIDGET_HAS_FOCUS(w)){
   gtk_widget_grab_focus(w);
   return TRUE;
 }

 return FALSE;
}



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