Example #1
0
void num3_clicked(GtkButton*w, GtkEntry *entry){

  if(sign){
    gtk_entry_set_text(entry, "");
  }
  GtkEntryBuffer *buffer = gtk_entry_get_buffer(entry);
  gtk_entry_buffer_insert_text (buffer, -1,"3", 1);
  gtk_entry_set_buffer(entry, buffer);
  sign = 0;
}
Example #2
0
/**
 * gtk_entry_buffer_set_text:
 * @buffer: a #GtkEntryBuffer
 * @chars: the new text
 * @n_chars: the number of characters in @text, or -1
 *
 * Sets the text in the buffer.
 *
 * This is roughly equivalent to calling gtk_entry_buffer_delete_text()
 * and gtk_entry_buffer_insert_text().
 *
 * Note that @n_chars is in characters, not in bytes.
 *
 * Since: 2.18
 **/
void
gtk_entry_buffer_set_text (GtkEntryBuffer *buffer,
                           const gchar    *chars,
                           gint            n_chars)
{
  g_return_if_fail (GTK_IS_ENTRY_BUFFER (buffer));
  g_return_if_fail (chars != NULL);

  g_object_freeze_notify (G_OBJECT (buffer));
  gtk_entry_buffer_delete_text (buffer, 0, -1);
  gtk_entry_buffer_insert_text (buffer, 0, chars, n_chars);
  g_object_thaw_notify (G_OBJECT (buffer));
}