gtk_editable_select_region and entry
- From: Olivier Pierard <pierard mema ucl ac be>
- To: gtk-list gnome org
- Subject: gtk_editable_select_region and entry
- Date: Mon, 23 Jan 2006 12:06:40 +0100
The function hereafter shows a dialog window which contains three frames
and in each one there is an entry. I set a text to these entry
(non-empty) and after I try to select all the text with
gtk_editable_select_region. It works properly for the first entry but
not for the two others. What's even stranger is that even when I remove
the three calls to gtk_editable_select_region, first entry is selected
and the two others are not.
Thank you very much !
Olivier
void description_dialog (GtkWidget *Widget, gpointer data)
{
SIMU *simu = (SIMU *)data;
GtkWidget *description_dialog, *frame, *entry1, *entry2, *entry3;
description_dialog = gtk_dialog_new_with_buttons("Descriptions",
GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
frame = gtk_frame_new("\nDescription of the simulation\n");
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);
entry1 = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry1),
gtk_label_get_text(GTK_LABEL(simu->param->description)));
gtk_entry_set_max_length (GTK_ENTRY (entry1), 40);
gtk_entry_set_width_chars (GTK_ENTRY (entry1), 50);
gtk_editable_select_region (GTK_EDITABLE(entry1), 0, -1);
gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(entry1));
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(description_dialog)->vbox),
frame, TRUE, TRUE, 0);
frame = gtk_frame_new("\nMatrix material\n");
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);
entry2 = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry2),
gtk_label_get_text(GTK_LABEL(simu->mtx->material)));
gtk_entry_set_max_length (GTK_ENTRY (entry2), 40);
gtk_entry_set_width_chars (GTK_ENTRY (entry2), 50);
gtk_editable_select_region (GTK_EDITABLE(entry2), 0, -1);
gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(entry2));
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(description_dialog)->vbox),
frame, TRUE, TRUE, 0);
frame = gtk_frame_new("\nInclusion material\n");
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);
entry3 = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry3),
gtk_label_get_text(GTK_LABEL(simu->icl->material)));
gtk_entry_set_max_length (GTK_ENTRY (entry3), 40);
gtk_entry_set_width_chars (GTK_ENTRY (entry3), 50);
gtk_editable_select_region (GTK_EDITABLE(entry3), 0, -1);
gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(entry3));
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(description_dialog)->vbox),
frame, TRUE, TRUE, 0);
gtk_widget_show_all(GTK_DIALOG(description_dialog)->vbox);
switch (gtk_dialog_run(GTK_DIALOG(description_dialog)))
{
case GTK_RESPONSE_OK:
gtk_label_set_text(GTK_LABEL(simu->param->description),
gtk_entry_get_text(GTK_ENTRY(entry1)));
set_colors_description(simu->param->description);
gtk_label_set_text(GTK_LABEL(simu->mtx->material),
gtk_entry_get_text(GTK_ENTRY(entry2)));
set_colors_material_name(simu->mtx->material);
gtk_label_set_text(GTK_LABEL(simu->icl->material),
gtk_entry_get_text(GTK_ENTRY(entry3)));
set_colors_material_name(simu->icl->material);
gtk_widget_destroy(description_dialog);
break;
case GTK_RESPONSE_CANCEL:
case GTK_RESPONSE_NONE:
default:
gtk_widget_destroy(description_dialog);
break;
}
}
--
******************************************************
** Olivier Pierard **
** PhD student, UCL **
** Center for Systems Eng. and Appl. Mech. (CESAME) **
** Bâtiment Euler, 4 Avenue G. Lemaitre **
** B-1348 Louvain-la-Neuve, Belgium **
** Tel.:+32 10 47.80.26 **
** Fax.:+32 10 47.21.80 **
** http://www.mema.ucl.ac.be/~pierard **
******************************************************
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]