GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Oct 24, 2014 11:26 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Display large amount of text
PostPosted: Tue Oct 08, 2013 3:53 pm 
Offline
Familiar Face

Joined: Tue Feb 28, 2012 1:16 pm
Posts: 11
Location: Russia
Hello.

What is the best way to display very large amount of text?

I need an ability to add new text to already displayed so i suppose GtkDrawingArea is not suitable?

I looked at GtkTextBuffer, but i think it's too heavy for my needs (am i right?)


Top
 Profile  
 
 Post subject: Re: Display large amount of text
PostPosted: Wed Oct 09, 2013 5:44 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 764
Location: UK
Hello,

Without knowing the context and how you want to display your text it is hard to give a definite answer.

GtkTextView / GtkTextBuffer is an ideal way of handling large amounts of text and still have it editable if needed, both by the application and the user.

_________________
E.


Top
 Profile  
 
 Post subject: Re: Display large amount of text
PostPosted: Wed Oct 09, 2013 7:59 am 
Offline
Familiar Face

Joined: Tue Feb 28, 2012 1:16 pm
Posts: 11
Location: Russia
Quote:
Without knowing the context

It's supposed to be a notebook and on each tab i want to display text.

Quote:
and how you want to display your text


I just want to show a user a plain text. Line by line, nothing special.


Top
 Profile  
 
 Post subject: Re: Display large amount of text
PostPosted: Thu Oct 10, 2013 3:23 pm 
Offline
GTK+ Guru

Joined: Sun Jan 17, 2010 6:48 pm
Posts: 102
Use a label widget -- its not restricted to just displaying of single lines of text. Combined with pango markup it can do all sorts of useful formatting for jobs such use in on screen reports. If you set the right flags, you can also copy the contents the clipboard for pasting elsewhere. If it gets really big, add it into a scrolling window.

Will

PS> Here's an example of one of my apps which uses a GtkLabel to display the results of a dictionary search. Setting colour attributes with a Pango string is much more convenient than creating tags and inserting strings into a text buffer.

Image

_________________
"If you don't stand for something, then you'll fall for anything."


Top
 Profile  
 
 Post subject: Re: Display large amount of text
PostPosted: Sun Oct 13, 2013 4:23 pm 
Offline
Familiar Face

Joined: Tue Feb 28, 2012 1:16 pm
Posts: 11
Location: Russia
Thank you, William. This is what i looked for.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group