Re: GtkText::set_line_wrap() on *Nix vs. Win32

From: Date: Fri, 29 Jun 2001 00:32:27 +0000
Subject: Re: GtkText::set_line_wrap() on *Nix vs. Win32
References: 1  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-1998@lists.php.net to get a copy of this message
Heya Frank, OK, I just tried running this in doze with the str_replace as suggested below, & nothing changed (no err msg either). I'm 6 months into using PHP (or anything else much really) at all, so it's possible my coding's not reflecting your suggestion. Here is my original script, not including yr part. I'm on win98 and when I run this every text line ends in a black box. & yep I'm taking it over to GTK+ list, but if anyone out there finds some way to stop those boxes happening other than making the line stop short of the line_wrap (with \n) - please relay yr findings to the PHP-GTK list? ty, Steph <? dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so')) || die("Can't load php_gtk module!\n"); function get_it($colorsel) { global $text; $text->delete_text(0, -1); $newcolorparts = $colorsel->get_color(); $part1 = $newcolorparts[0]; $rr = dechex ($part1*255); $part2 = $newcolorparts[1]; $gg = dechex ($part2*255); $part3 = $newcolorparts[2]; $bb = dechex ($part3*255); $newcolor = &new GdkColor("#$rr$gg$bb"); $text->insert(null, $newcolor, null, 'You can have any colour you like so long as it\'s not black, cos I didn\'t write a workaround for NULL!', -1); } $window = &new GtkWindow(); $window->set_title("testbay window"); $window->set_uposition(0, 0); $window->connect_object('destroy', array('gtk', 'main_quit')); $hpaned = &new GtkHPaned(); $window->add($hpaned); $hpaned->show(); $colorsel = &new GtkColorSelection(); $colorsel->set_opacity(TRUE); $colorsel->set_color(0.75, 0.85, 0.35, 1.0); $colorsel->set_update_policy(GTK_UPDATE_DELAYED); $colorsel->connect('color-changed', 'get_it'); $hpaned->add1($colorsel); $colorsel->show(); $text = &new GtkText(); $text->set_editable(TRUE); $text->set_line_wrap(TRUE); $hpaned->add2($text); $text->show(); $window->show_all(); Gtk::main(); ?> ----- Original Message ----- From: "Frank M. Kromann" <frank@frontbase.com> To: "Steph" <steph.fox@btinternet.com> Sent: Thursday, June 28, 2001 9:13 PM Subject: Re: [PHP-GTK] GtkText::set_line_wrap() on *Nix vs. Win32 You can use \n in any string or do a str trplace before inserting the striong. $content = str_replace("\r\n", "\n", $content); - Frank > can I just add to this that any "insert_text" added just by typing it as a long > string there & then, no \r no \n no \nothing, produces what appears to be hard carriage returns > at the end of the linewrap when the linewrap is enabled ... again in win32 > > ----- Original Message ----- > From: "Geoff A. Virgo" <wig@mithril.ca> > To: <php-gtk@lists.php.net> > Sent: Wednesday, June 27, 2001 7:19 PM > Subject: Re: [PHP-GTK] GtkText::set_line_wrap() on *Nix vs. Win32 > > > At 08:20 AM -0500 Wednesday, 6/27/01, you wrote: > > >I bet those are your carriage returns (\r). Unix doesn't have them, it > >only uses newlines (\n). Try replacing all \r\n combinations with \n > >before inserting into GtkText. > > Thanks for the suggestion Andrei, a CR/LF problem was also my thought of > what might be causing the problem. However, I've checked it out and my > editor is set to not save PHP files with CR/LF, and I don't use \r or \r\n > in my source. Just out of curiosity I tried replacing all instances of \n > with \r\n and it gave me clear character boxes to represent all the \r > characters I'd added in. If it'd help, I can mail you a screenshot of this > happening and the string I'm filling GtkText with. Let me know if you need > to see it. > > I'm guessing that your reply means you don't see the same little black > boxes on your *Nix setup? Do you know if the same thing shows up in other > the GTK language bindings like Python? The black boxes don't appear on > lines which I manually wrap, so I guess I'm going to have to write some > sorta work around for Win32. > > > > Cheers, > > Geoff A. Virgo > http://www.mithril.ca/ > > ------------------------------------------------------------------------------------------------------------------------ > Do not meddle in the affairs of programmers, for they are subtle and quick > to anger. > > > -- > 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 > > >

« previous php.gtk (#1998) next »