help
- From: "Paul Akkermans" <paulakkermans wanadoo nl>
- To: <gtk-app-devel-list gnome org>
- Subject: help
- Date: Sat, 25 Sep 2004 12:28:47 +0200
Hi group,
I have the following code:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
/*
*File name: text.c
*/
#include <gtk/gtk.h>
#include <glib.h>
/*-- This function allows the program to exit properly when the window is closed --*/
//gint destroyapp (GtkWidget *widget, gpointer gdata)
//{
// g_print ("Quitting...\n");
// gtk_main_quit();
// return (FALSE);
//}
int create_new (int argc, char *argv[])
{
/*-- Declare the GTK Widgets used in the program --*/
GtkWidget *window;
GtkWidget *text;
gchar *buffer = "This is some sample text";
/*-- Initialize GTK --*/
gtk_init (&argc, &argv);
/*-- Create the new window --*/
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/*-- Create a text area --*/
text = gtk_text_new(NULL, NULL);
/*-- Set text area to be editable --*/
gtk_text_set_editable(GTK_TEXT (text), TRUE);
/*-- Connect the window to the destroyapp function --*/
// gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(destroyapp), NULL);
/*-- Add the text area to the window --*/
gtk_container_add(GTK_CONTAINER(window), text);
/*-- Add some text to the window --*/
gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL, buffer, strlen(buffer));
/*-- Set window border to zero so that text area takes up the whole window --*/
gtk_container_border_width (GTK_CONTAINER (window), 0);
/*-- Set the window to be 640 x 200 pixels --*/
gtk_window_set_default_size (GTK_WINDOW(window), 640, 200);
/*-- Set the window title --*/
gtk_window_set_title(GTK_WINDOW (window), "Text Area");
/*-- Display the widgets --*/
gtk_widget_show(text);
gtk_widget_show(window);
/*-- Start the GTK event loop --*/
gtk_main();
/*-- Return 0 if exit is successful --*/
return 0;
}
-------------------------------------
It is my intention to read out the characters that are typed in in the text window. But I don't know how to
do this. Can anybody help me?
Thanks in advance
Paul Akkermans
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]