473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Can someone help with this? Linux GTK / Ncurses

Ok, I'm trying to create a GTK+ application that scrolls Hs across the
screen until you press q or Q. I've got it working in console wise
using ncurses. What I'm trying to do now is make a full screen GTK+
gui based way of it to scroll the Hs until the keypress. I tried
manipulating them together, but the console loads up first, and when
you hit q, it'll fill the data into the GTK+ text_view, but it's quit
at that time.

If anyone could shed some light and help I'd apprietiate it.

-Chuck

** CODE FOLLOWS **

#include <gtk/gtk.h>
#include <ncurses.h>

static gboolean delete_event( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
g_print ("delete event occurred\n");
return TRUE;

}

/* Another callback */
static void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();

}

int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *textview;
GtkTextBuffer *buffer;

gtk_init (&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_fullscreen(GTK_WINDOW(window));

g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (delete_event), NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (destroy), NULL);

textview = gtk_text_view_new ();
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));

gtk_container_add (GTK_CONTAINER (window), textview);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview ), GTK_WRAP_CHAR);
gtk_widget_show (textview);
gtk_widget_show (window);
/* int timer = 0;
while (timer != 10000)
{
gtk_text_buffer_insert_at_cursor(buffer, "H", -1);
timer = timer + 1;
}*/

//
************************************************** ************************************************** ***
int ch = 0;
int backg = 0;
int foreg = 7;
initscr();
start_color();
init_pair(1, 2, 3); // 0-7
cbreak();
noecho();
nodelay(stdscr, TRUE);
do
{
ch = getch();
init_pair(1, foreg, backg);
attron(COLOR_PAIR(1));
gtk_text_buffer_insert_at_cursor(buffer, "H", -1); //
wprintw(stdscr,
"H");
switch( ch )
{
case 'Q' :
case 'q' : gtk_text_buffer_insert_at_cursor(buffer,
"QUITTING",
-1); //wprintw(stdscr, "\nQuitting...");
break;
case 'B' :
case 'b' : if (backg == 7) backg = 0;
else backg = backg + 1;
break;
case 'F' :
case 'f' : if (foreg == 7) foreg = 0;
else foreg = foreg + 1;
break;
default : break;
}
attroff(COLOR_PAIR(1));
refresh();

} while ((ch != 113) && (ch != 81));
gtk_main ();
refresh();
getch();
endwin();
//
************************************************** ************************************************** *****

return 0;

}
Dec 14 '07 #1
1 2352
On Fri, 14 Dec 2007 08:21:42 -0800 (PST), ChuckB
<CE*********@gmail.comwrote in comp.lang.c:
Ok, I'm trying to create a GTK+ application that scrolls Hs across the
screen until you press q or Q. I've got it working in console wise
using ncurses. What I'm trying to do now is make a full screen GTK+
gui based way of it to scroll the Hs until the keypress. I tried
manipulating them together, but the console loads up first, and when
you hit q, it'll fill the data into the GTK+ text_view, but it's quit
at that time.

If anyone could shed some light and help I'd apprietiate it.

-Chuck

** CODE FOLLOWS **

#include <gtk/gtk.h>
#include <ncurses.h>
[snip]

I'd suggest you try new:comp.os.linux.development.apps.

As far as the C language and this group are concerned, gtk and ncurses
are both just non-standard 3rd party libraries, and off-topic here.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Dec 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: arve.knudsen | last post by:
Hi I'm trying to build a Python package that I can use on different Linux setups, for this purpose it would be nice to weld external dependencies (libraries) into Python itself. So far I've...
1
by: Jean-Christian Imbeault | last post by:
On my RH 9.0 linux system when ./configuring 7.3.4 I get an error about not finding the readline libs, however both the readline and readline-devel rpms are installed: # rpm -qa | grep readline...
4
by: Daniele | last post by:
Dearest, I wanna make my little software (~400slc) on Ms-Windows. Dependencies are Ncurses (-lncurses) and Math (-lm). I need to compile this software as .exe. Is possible? How? Help me,...
30
by: Ian Ward | last post by:
When I run the following code in a terminal with the encoding set to UTF-8 I get garbage on the first line, but the correct output on the second. import curses s = curses.initscr()...
48
by: Daniele C. | last post by:
As soon as my sourceforge.net project gets approved, I am going to build a ncurses port to win32 bindable to sockets, e.g. allowing VT100/ANSI terminals and the creation of simple terminal servers...
10
by: krishnakant Mane | last post by:
hello all. I am developing an ncurses based python application that will require to create pdf reports for printing. I am not using py--qt or wx python. it is a consol based ui application and I...
15
by: John Nagle | last post by:
I've been installing Python and its supporting packages on a dedicated server with Fedora Core 6 for about a day now. This is a standard dedicated rackmount server in a colocation facility,...
2
by: =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki | last post by:
Is it a library at C++ by means of library of ncurses at linux,that it implement library of ncurses but by means language of C++,it is by means of class,struct and other? if yes is it any?
3
by: sirix | last post by:
Hi, I'm using g++ 4.1.2 and ncurses 5.6. Following simple code correctly displays dimensions of an xterm while one resizes it's window. I thought that uncommenting wouldn't change anything in a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.