Re: $text->insert( ... - Drives me Nuts
| From: | jasonr at argia dot net | Date: | Wed, 14 Feb 2024 13:40:18 +0000 |
| Subject: | Re: $text->insert( ... - Drives me Nuts | ||
| Groups: | php.gtk | ||
| Request: | Send a blank email to php-gtk+get-1005@lists.php.net to get a copy of this message | ||
looks good, but another q...
how to use a "transparent" background color? all zeros makes black, so that isnt it. cant
leave it out, or the insert function complains...
also isnt there some sort of built in variable or shortcut to use the default font? that would be
handy as well. All i want to do is change the foreground color of the insert_text function, which
takes no arguments other than the text to be inserted.
> On Tue, Mar 20, 2001 at 11:58:58AM +1200, Martin Cameron wrote:
> > I'm trying to get some text to insert into a text area. I keep getting
> > the error message:
> >
> > insert() expects argument 1 to be gdkfont, string given in
> > <b>note.php</b> on line <b>47</b><br>
> >
> > for the following:
> >
> > $text = & new GtkText();
> > $text->freeze();
> > $text->set_editable(TRUE);
> > $text->insert(defaultfont, $text->style->black, NULL,$labeltext,-1);
> > $text->thaw();
> > $text->show();
> >
> >
> >
> > If I change
> >
> > $text->insert(defaultfont, $text->style->black,
> > NULL,$labeltext,-1);
> >
> > to:
> >
> > $text->insert(NULL, $text->style->black, NULL,$labeltext,-1);
> >
> > I get this error:
> >
> > <b>Warning</b>: insert() expects argument 1 to be gdkfont,
> > NULL given in <b>note.php</b> on line <b>47</b><br>
> >
> > Now if NULL isn't NULL, what is.
>
> have you tried passing a GdkFont object as the first argument ?
>
> try this :
>
> ---Begin Code---
>
> $font = Gdk::font_load("-misc-fixed-medium-r-*-*-*-140-*-*-*-*-*-*");
> $fg = new GdkColor(0,0,0);
> $bg = new GdkColor(65535,65535,65535);
>
> $text->insert($font,$fg,$bg,"hello, this is a test");
>
>
> ---End Code---
>
>
> that will insert "hello, this is a test" using a white background, black text with a
> fixed width font.
>
> hth
>
> barry
>
> >
> > Thanks in advance
> >
> > Martin Cameron
> >
> >
>
> --
> http://www.theshining.org
>
> --
> PHP GTK Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-gtk-unsubscribe@lists.php.net
> For additional commands, e-mail: php-gtk-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net