Fwd: Re: [PHP-GTK] GTKText solutions?
| From: | Benjamin Smith | Date: | Tue, 04 Feb 2003 01:29:58 +0000 |
| Subject: | Fwd: Re: [PHP-GTK] GTKText solutions? | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-3004@lists.php.net to get a copy of this message | ||
Also, this method causes weird stuff to happen with the cursor when you are
inserting text - it's definitely NOT optimum!
-Ben
---------- Forwarded Message ----------
There's enough there (I suppose) to come up with something.
I'm well into development of a mid-sized project using PHP-GTK, and this has
to be licked somehow. So far, it looks like I'll have to trap the signal
'changed' and reload the gtktext object's contents when a wordwrap event is
encountered. Something like
<?
Function DieBoxes($from)
{
global ${$from};
$text=${$from}->Get_Chars(0, -1);
if (($new=wordwrap($text, 40, "\n", 1))!=$text)
{
${$from}->Delete_Text(0, -1);
${$from}->Insert_Text($new, 0);
}
}
$textbox=&New GtkText();
$textbox->Set_Editable(true);
$textbox->connect('changed', 'DieBoxes', 'textbox');
?>
While wasteful and cumbersome, this appears to work. I was just wondering if
anybody else'd come up with something more elegant. Also, I've had some
concerns about this method and the following:
" it cannot cope with very frequent text updates for long"
Is there a better way?
(As far as "frequent updates", I've run test loops of 1000 each numerous
times, deleting and then replacing slightly modified text in gtktext()
without issues... are we talking hundreds of thousands? Millions? ...?)
-Ben
On Sunday 02 February 2003 08:26 pm, you wrote:
> Does this mean that you didn't find the manual page, or that there
> wasn't enough info there?
>
> http://gtk.php.net/manual/en/gtk.gtktext.php
>
> I wrote something a long time ago, it's on an old hard drive and
> probably isn't very good anyway but it does kind of work. I'll dig it
> out if you're still stuck tomorrow :)
>
> The other option is gtkscintilla, which has recently become available
> for win32. It looks like a text widget should, and is way more flexible
> than gtktext, but you'll need to refer back to the original docs for it
> because these haven't been started yet on gtk.php.net beyond their
> initial generation from source.
>
> HTH,
>
> - Steph
>
> ----- Original Message -----
> From: "Benjamin Smith" <bens@effortlessis.com>
> To: <php-gtk-general@lists.php.net>
> Sent: Monday, February 03, 2003 3:46 AM
> Subject: [PHP-GTK] GTKText solutions?
>
> > What's the best way to get the functionality of GtkText without the
>
> "black
>
> > box" syndrome for Windows development?
> >
> > Yes, I know it's officially "broken".
> >
> > Has anybody come up with a wrapper function/method/class extension
>
> that
>
> > allows for this with reasonable grace? How might you approach a
>
> reasonable
>
> > workaround?
> >
> > -Ben
> >
> > --
> > PHP-GTK General Mailing List (http://gtk.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-------------------------------------------------------