有没有办法将林间空地和GTK连接起来?

时间:2019-05-19 16:13:58

标签: c glade

我想用gtk和glad制作一个在gtktextview中打印的应用程序,gtkbuffer中有什么。我该怎么做 ?

我尝试了很多事情,但是gtk的gtktextview却不知道林间空地的gtktextview。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

GtkWidget  *text_view;
//GtkTextView *text_view;
GtkBuilder      *builder;
//GtkTextBuffer *text_buffer;
GtkWidget *text_buffer;

void recieved_text (gchar *m) {
//  GtkTextIter e;
//  printf("yo msg :%s ",m);
(void)m;

GtkTextIter start,end;
GtkTextView *vu= GTK_TEXT_VIEW(text_view);

GtkTextBuffer *buffer = gtk_text_view_get_buffer (vu);
char *text;

gtk_text_buffer_get_bounds (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);


printf("text in textview: %s\n",text);
gtk_text_buffer_insert(buffer, &end, m, -1);

gtk_text_buffer_insert(buffer, &end, "\n", -1);
char * text2;
gtk_text_buffer_get_bounds (buffer, &start, &end);
text2 = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
printf("text2 in textview: %s\n",text2);
}

0 个答案:

没有答案