Egon Andersen <[EMAIL PROTECTED]> writes: > Hi, > > (GTK+-2.0) > I'm trying to make text (numbers) right-justified in a GtkEntry, but I > haven't been able to do it right. > The best I've got until now is to use: > gtk_widget_set_direction (entry, GTK_TEXT_DIR_RTL); > but that is not a good solution, as it is setting the direction the > text is entered, which is not quite the same as text justification, > and gives a 'strange' cursor behaviour. > > Do anyone have a solution or a hint? > I'm willing to make my own widget type, if someone can point me in the > right direction to solve the problem.
Unfortunately, I don't think there is any real alternative to cut-and-pasting GtkEntry, renaming it, and adding right justification to it; I believe that basically all that is needed is in gtk_entry_adjust_scroll(): if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_LTR) { min_offset = 0; max_offset = MAX (min_offset, logical_rect.width / PANGO_SCALE - text_area_width); } else { max_offset = logical_rect.width / PANGO_SCALE - text_area_width; min_offset = MIN (0, max_offset); } Should be: if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_LTR && !right_justified) { ... } [ Note, if your code isn't [L]GPL, then you'll need to create a separate library to hold the cut-and-paste of GtkEntry ] Regards, Owen _______________________________________________ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list