LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 04-12-2005, 08:26 AM   #1
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Rep: Reputation: 120Reputation: 120
A good simple text display widget in GTK (not Label)


I am looking for a simple text display widget in GTK2 that will easily display the numbers in a calculator application that I'm creating.

I tried using GtkLabel. Too simple. I cannot set text and background colour for this widget.

I tried using GtkTextView. Here I could set the text and background colour, but too complex. I don't need a full editor where I cannot easily set/retrieve the text values.

I tried using GtkEntry. Here it is easy to use, but I cannot set the alignment to right (which is a prerequisite for displaying a calculator view.

Is there any other widget which I can use which I can:

1. Set the text and retrieve it with one simple function call.
2. Set the background and text colour?
3. Will have an option to text align right?

Thanks.
 
Old 04-12-2005, 10:42 AM   #2
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
Quote:
I tried using GtkLabel. Too simple. I cannot set text and background colour for this widget.
You can! Put the label into a GtkEventBox and use gtk_widget_modify_* -functions on the eventbox.

Quote:
I tried using GtkEntry. Here it is easy to use, but I cannot set the alignment to right (which is a prerequisite for displaying a calculator view.
There is gtk_entry_set_alignment(), but it requires gtk 2.4 or newer.
 
Old 04-12-2005, 10:14 PM   #3
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Original Poster
Rep: Reputation: 120Reputation: 120
Thank you, Harmaa Kettu, for the tip with regard to GtkEntry. It works now.
 
Old 05-18-2006, 05:44 AM   #4
Gitti
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
Question GtkEntry

Quote:
Originally Posted by Harishankar
I am looking for a simple text display widget in GTK2 that will easily display the numbers in a calculator application that I'm creating.

I tried using GtkLabel. Too simple. I cannot set text and background colour for this widget.

I tried using GtkTextView. Here I could set the text and background colour, but too complex. I don't need a full editor where I cannot easily set/retrieve the text values.

I tried using GtkEntry. Here it is easy to use, but I cannot set the alignment to right (which is a prerequisite for displaying a calculator view.

Is there any other widget which I can use which I can:

1. Set the text and retrieve it with one simple function call.
2. Set the background and text colour?
3. Will have an option to text align right?

Thanks.
Hello,
I will set the color in a GtkEntry, but under SuSE 9.3 with KDE does not work.
My sourcecode:
entry = gtk_entry_new();
gtk_box_pack_start_defaults( GTK_BOX(vbox), GTK_WIDGET(entry));
gtk_entry_set_text( GTK_ENTRY(entry), "Zweites Editfeld" );
gdk_color_parse("red", &color);
gtk_widget_modify_text(entry, GTK_STATE_NORMAL, &color);

gtk_widget_show_all(GTK_WIDGET(fenster));

Who can help me? Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kommander - dynamic label widget Artanicus Linux - Software 0 02-22-2005 11:00 AM
A good text editor...this should be simple. TheMusicGuy Linux - Software 9 10-06-2004 12:16 AM
Good simple text editor like WinSyntax needed eBopBob Linux - Software 5 08-18-2004 03:15 PM
Which GTK Widget to use? jpbarto Programming 0 11-20-2003 07:34 PM
what is a gtk-widget ? gladeiator Programming 3 10-30-2003 05:34 PM


All times are GMT -5. The time now is 07:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration