Re: right align
| From: | Elgin Koh | Date: | Fri, 03 Oct 2003 02:38:44 +0000 |
| Subject: | Re: right align | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3939@lists.php.net to get a copy of this message | ||
Hi Brad,
Thanks for your reply.
Unfortunately I've implemented another solution - basically by using
a 1x1 GtkClist as a substitute. The only downside is that I have to
implement event boxes to capture keystrokes, which I think I have to do with
your solution anyway.
In the meantime, I'm posting this to the mailing list for those who
would like to try it out.
Elgin
----- Original Message -----
From: "bradm" <bradm@netlinux.com>
To: "Elgin Koh" <elginkoh@softhome.net>
Sent: Tuesday, September 30, 2003 10:01 AM
Subject: right align
>
> --
> bradm <bradm@netlinux.com>
>
> just got my email working could receive but not send
>
> noticed no one responded to your post
>
>
> try this
>
> function calculator_display($new_value,$entry)
> {
> // make the string the same length all the time so it will be
> right
> justified
>
>
$font=gtk::font_load("-*-helvetica-bold-r-normal-*-30-*-*-*-*-*-*-*");
> $width = $font->width($new_value);
> $padding = str_repeat(' ',(230 - $width)/7);
> $padded_value = $padding .= $new_value;
> $entry->set_text($padded_value);
> }
>
>
> i wrote a calculator program and this is how i solved the problem
>
> you will have to test diff values in the str_repeat
> function depending
> on the size of the text you use entry widget
>
> please respond by letting me know if this works for you or not
>
> if so please post it, as i do not know how to post to the forum
>
> brad
>
>