Re: Getting text out of a GtkTextView



You've created two pointers to a GtkTextIter, but they don't point to a valid GtkTextIter structure in memory. Here's what you probably meant to do...

void insertCustomer( GtkWidget	*customers )
{
	GtkTextBuffer	*specialBuffer;
	GtkTextView		*specialView;
	GtkTextIter		start;
	GtkTextIter		end;
	gchar*			*specialText;

   specialView = lookup_widget(customers, "cust_instructions");
	specialBuffer = gtk_text_view_get_buffer(specialView);
	gtk_text_buffer_get_bounds(specialBuffer, &start, &end);
	specialText = gtk_text_buffer_get_text(specialBuffer, &start, &end, FALSE);
	g_print("Special Text: %s \n",specialText);
}

- Seth

Carl B. Constantine wrote:

I have a GtkTextView in one of my application windows; mainly because a
GtkEntry is only single width and I want text wrapping and so forth.

Anyway, I'm trying to get the text from the GtkTextView but only end up
with 'null' when I try to print it. Here is a code snipped:

void insertCustomer( GtkWidget	*customers )
{
	GtkTextBuffer	*specialBuffer;
	GtkTextView		*specialView;
	GtkTextIter		*start;
	GtkTextIter		*end;
	gchar*			*specialText;

   specialView = lookup_widget(customers, "cust_instructions");
	specialBuffer = gtk_text_view_get_buffer(specialView);
	gtk_text_buffer_get_bounds(specialBuffer, start, end);
	specialText = gtk_text_buffer_get_text(specialBuffer, start, end, FALSE);
	g_print("Special Text: %s \n",specialText);
}

I actually want to be able to insert that text into a database field but
it's not working.

Any help is appreciated.


--
Seth Remington
SaberLogic, LLC
661-B Weber Drive
Wadsworth, Ohio 44281
Phone: (330)335-6442
Fax: (330)336-8559





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]