From: "ldries46" <bertus.dries@planet.nl>
Subject: Problem with Saving and printing a Gtk Textbuffer
Date: Tue, 20 Nov 2018 09:30:35 +0100
Date: 2018-11-20T09:30:35+01:00 [thread overview]
Message-ID: <5bf3c62a$0$14970$e4fe514c@news.kpn.nl> (raw)
I have a Gtk Textbuffer with some text in it. I want to save or print the
contents of the buffer therefore I use in both cases about the same
construction with transporting to a string in a put Line for saving and ,
as shown in the example code, to a drawbuffer used for printing.
Get_Start_Iter(Draw_Buffer, start_it);
Get_End_Iter(Draw_Buffer, end_it);
Draw_Buffer.Delete(start_it, end_it);
len := Main_Window.Output_Buffer.Get_Line_Count;
nr := 1;
while nr < len loop
Get_Iter_At_Line(Main_Window.Output_Buffer, start, nr);
Get_Iter_At_Line_Offset(Main_Window.Output_Buffer, stop, nr, 500);
str := To_Unbounded_String(Main_Window.Output_Buffer.Get_Text(start,
stop));
Num_Line := Get_Back(str);
Draw_Buffer.Insert_At_Cursor(To_String(Num_Line.str & CRLF));
nr := nr + 1;
end loop;
With saving after the loop is an Close statement voor the file,with printing
the the printing is initiated there.
The problem is that somewhere within the loop the program crashes and I
cannot find where.
I used exceptitons to run the program to the end and found with saving that
the file exists but is not closed. Closing the program also closes the file
and I can see that the contents of the file is correct. Before stopping the
program the operating system tells me that another program is using the file
when trying to open it with wordpad. The pproblem with printing is simular.
Who can help me?
Bertus Dries
next reply other threads:[~2018-11-20 8:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-20 8:30 ldries46 [this message]
2018-11-20 13:12 ` Problem with Saving and printing a Gtk Textbuffer ldries46
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox