Re: aligning an GtkEntry widget



I was going to assume that you could do something
like this:

gtk_misc_set_alignment(GTK_MISC(entry->label)), x, y);

assuming that a GtkEntry implements its text buffer
with a GtkLabel.

But it doesnt. I dont think there is a
way to do that "out-of-the-box". Unless
I'm missing something I suggest you copy-paste
the code for GtkEntry ... call it something else
... and change the "gchar *text" member of the structure
to a "GtkLabel *text" (and do the appropriate adjustments)
add an accessor function (gtk_entry_get_label()) and with that
you can do all the label functions and GtkMisc functions
usefull fot that.

(of course it would probably be more elegant to
inherit from GtkLabel .... but alot more work,
the former I think is quite trivial)

Cheers,
        -Tristan


Dimitar Haralanov wrote:

        Hi, is there a way that I can right-align a GtkEntry? I would like to
get the text to be always added from the left, instead of from the
right. I looked at the API and did not find anything that might be
helpful.

        Thanx
                -- Mitko

--
========================================================================
     __  __  __________________ _________
    /  |/  |/  /__/__   ___/  |/  /     /      Dimitar Haralanov
   /          /  /  /  /  /      /  /  /       Software Engineer
  /   /   /  /  /  /  /  /  /\  \  /  /        Tahoe Networks
 /___/___/__/__/  /__/  /__/  |__|___/         mitko tahoenetworks com

========================================================================
  GPG Fingerprint:  21C1 8244 93F3 F2E9 013C  0C12 70DC C58E 6337 ABD1
-----------------------------------------------------------------------
-What makes the universe so hard to comprehend is that there's nothing
to compare it with.

  ------------------------------------------------------------------------
   Part 1.2Type: application/pgp-signature



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