Re:How retrieve the content of GtkTextView (1 viewing) (1) Guest
Favoured: 0
|
|
|
TOPIC: Re:How retrieve the content of GtkTextView
|
motenai (User)
Fresh Boarder
Posts: 12
|
|
How retrieve the content of GtkTextView 5 Months, 3 Weeks ago
|
Karma: 0
|
|
Hi,
How can I retrieve the text wrote in a GtkTextView ???
I thought that a buffer was automatically create with a new GtkTextView object and it was possible to retrieve easily the content with get_buffer() method... Unfortunately, when I ask to php-gtk to print the result, i have only the word "Object". So, I need your help ^_^;
Thanks
Mote
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
kksou (Admin)
Admin
Posts: 443
|
|
Re:How retrieve the content of GtkTextView 5 Months, 3 Weeks ago
|
Karma: 8
|
|
Hi Mote,
First you need to get the GtkTextBuffer:
$buffer = $textview->get_buffer();
Then you retrieve the content from the text buffer with:
$start = $buffer->get_start_iter();
$end = $buffer->get_end_iter();
$str = $buffer->get_text($start, $end);
Or, if you prefer a one-liner:
$str = $buffer->get_text($buffer->get_start_iter(), $buffer->get_end_iter());
Regards,
/kksou
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
motenai (User)
Fresh Boarder
Posts: 12
|
|
Re:How retrieve the content of GtkTextView 5 Months, 2 Weeks ago
|
Karma: 0
|
|
Hi kksou !
Thank you for the solution ! You're the man ! And yep, I prefer the one-liner way :D lol
Now, I let you and I return to File_PDF... yeah... I like play with class without or with poor documentation :P Fuckin' crap !!!!
Thanks again !
Mote
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
|
|
|
|