Cursor Position Not Updated
| From: | someGuy | Date: | Mon, 06 Nov 2006 03:33:22 +0000 |
| Subject: | Cursor Position Not Updated | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-3518@lists.php.net to get a copy of this message | ||
Hi all,
Problem: The cursor position in both the GtkEntry and GtkTextView are not
properly updated after moving the cursor under program control (inserting
text).
Operating System: Windows only
PHP-Gtk2 version: Gnope 1.5.1 (php-gtk2 alpha?) date stamp: July 18, 2006
Code for GtkTextView:
<?php
$clipboard = GtkClipboard::get();
$textView = new GtkTextView();
$window = new GtkWindow();
$window->add($textView);
$window->show_all();
$startMark = $textView->get_buffer()->get_insert();
$startIter = $textView->get_buffer()->get_iter_at_mark($startMark);
$startPosition = $startIter->get_offset();
echo("Before:\nTextMark: " . $startMark . "\n" .
"Iter: " . $startIter . "\n" .
"cursor position: " . $startPosition . "\n\n");
$clipboard->set_text("test");
$textView->get_buffer()->paste_clipboard($clipboard, null, true);
$endMark = $textView->get_buffer()->get_insert();
$endIter = $textView->get_buffer()->get_iter_at_mark($endMark);
$endPosition = $endIter->get_offset();
echo("After:\nTextMark: " . $endMark . "\n" .
"Iter: " . $endIter . "\n" .
"cursor position: " . $endPosition . "\n");
gtk::main();
?>
Code for GtkEntry:
<?php
$clipboard = GtkClipboard::get();
$entry = new GtkEntry();
$window = new GtkWindow();
$window->add($entry);
$window->show_all();
$startPosition = $entry->get_position();
echo("Before:\n" .
"cursor position: " . $startPosition . "\n\n");
$clipboard->set_text("test");
$entry->paste_clipboard();
$endPosition = $entry->get_position();
echo("After:\n" .
"cursor position: " . $endPosition . "\n");
gtk::main();
?>
These two code fragments work properly with Linux and FreeBSD.
-Ron T.
--
View this message in context: http://www.nabble.com/Cursor-Position-Not-Updated-tf2580232.html#a7192836
Sent from the Php - GTK - Dev mailing list archive at Nabble.com.