Re: Verifying input data before gtk_dialog_run returns



Hello,

What you should do is 


void enter_callback(GtkWidget *widget, GtkWidget *entry)
{

  gchar *entry_text = NULL;
  entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
 
  // Check to se what the entry contains...
  printf("the entry: %s\n", entry_text);


}

main()
{

  ....


  entry = gtk_entry_new();

  g_signal_connect(GTK_OBJECT(entry), "key-press-event",
                     GTK_SIGNAL_FUNC(enter_callback),
                     entry);

}

BUT! I get a segmentation fault at gtk_entry_get_text(GTK_ENTRY(entry))
that I dont understand...

I seams as the entry don't gets its content until you press enter.
The funny thing is that the signal "backspace" works as expected.

There should realy be a signal "key-insert" to validate characters
in progress into the entry widget. But I can't find sutch.

-- 
Göran Hasse

----------------------------------------------------------------
Göran Hasse            email: gh raditex se     Tel: 08-6949270
Raditex AB             http://www.raditex.se    
Planiavägen 15, 1tr                             Mob: 070-5530148
131 34  NACKA, SWEDEN                         OrgNr: 556240-0589
VAT: SE556240058901
------------------------------------------------------------------




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