[Glade-users] dynamic label on dialog box.
- From: ashats at hotmail.com (Arthur Shats)
- Subject: [Glade-users] dynamic label on dialog box.
- Date: Wed, 8 Sep 2010 20:18:30 +0000
In Glade-2 I created a window with a few entry fields and a 'Next' btn. I also have one dialog box with OK
btn that would be displayed if input in any of the entry fields is invalid. Depending on which entry field is
invalid, I would like to put different msg (a label) on the dialog box. After user clicks OK btn on the
dialog box, the box disappears and focus is set to the entry field that was invalid. My question is how to
put a label on a dialog box dynamically, from the code. I am writing in C.
I display the dialog box in Next btn clicked event and the way I do it is this:
if (field1_is_invalid || field2_is_invalid || field3_is_invalid) {
dialog1 = create_dialog();
if (field1_is_invalid) {
/* put label on the dialog box */
gtk_dialog_run(GTK_DIALOG(dialog1));
gtk_widget_hide(dialog1);
gtk_widget_grab_focus(entry_field1);
}
else if (field2_is_invalid) {
/* put some other label on the dialog box */
gtk_dialog_run(GTK_DIALOG(dialog1));
gtk_widget_hide(dialog1);
gtk_widget_grab_focus(entry_field2);
}
else if (field3_is_invalid) {
/* put yet another label on the dialog box */
gtk_dialog_run(GTK_DIALOG(dialog1));
gtk_widget_hide(dialog1);
gtk_widget_grab_focus(entry_field3);
}
}
So, how do I put a label on a dialog box from C code?
Thanks much.
Arthur.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20100908/484028f1/attachment.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]