problem extracting data from GtkSourceView using Gtkd

Chris Bare chris at bareflix.com
Mon Jan 14 22:52:48 UTC 2019


I would have posted this in the Gtkd forum, but it has been down 
for a while.

I'm porting a GTK2/C program to Gtkd. I'm trying to read the data 
from a GtkSourceView, but when I try to get the bounds, it's 
always zero.

Here's the c version that works:
	GtkSourceBuffer *bf;
	GtkTextIter start, end;
	int len;

	bf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w.mainTxt));
	gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER(bf), &start, &end);
	data = gtk_text_buffer_get_text (GTK_TEXT_BUFFER(bf), &start, 
&end, FALSE);

Here's what I tried in D:
	SourceBuffer bf;
	auto start = new TextIter();
	auto end = new TextIter();

	bf = this.mainTxt.getBuffer ();
	bf.getBounds (start, end);
	string str = bf.getText (start, end, false);

getBounds is defined as: getBounds(out TextIter start, out 
TextIter end)

Is there something I'm doing wrong?
Any suggestions on what else to try?




More information about the Digitalmars-d-learn mailing list