Re: $text->insert( ... - Drives me Nuts

From: Date: Tue, 20 Mar 2001 09:39:52 +0000
Subject: Re: $text->insert( ... - Drives me Nuts
References: 1  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-1004@lists.php.net to get a copy of this message
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

« previous php.gtk (#1004) next »