我如何创建一个使用gtk读写行的textarea [英] How can i create a textarea that has read and write lines using gtk

查看:108
本文介绍了我如何创建一个使用gtk读写行的textarea的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道如何创建文本区域,该区域显示无法编辑的文本行,但可以编辑最底部的文本行。



基本上和嵌入式控制台类似,它允许你直接在应用程序上运行代码。

目前使用textview我可以去编辑上面的代码和输出响应也是可编辑的。

解决方案可以使用 GtkTextView 但并非微不足道。您必须创建一个使文本不可编辑的标签,并将其从缓冲区的开头应用到结束位置之前。然后,当您接收并处理输入时,扩展或重新应用标记以涵盖该输入行和您的程序对其的响应。



下面是它正在完成的一个示例:




Any one know how i can create a text area which displays lines of text which can not be edited but allows you to edit the bottom most line for text.

basically in a similar fashion to embedded consoles inside applications that allow you to run code direct on the application.

currently using a textview i can go and edit the code above and the output response are also editable.

解决方案

It's possible using a GtkTextView, but not trivial. You have to create a tag that makes the text uneditable, and apply it from the beginning of the buffer to just before the end position. Then when you receive and process input, extend or re-apply the tag to cover that line of input and your program's response to it.

Here's an example of it being done:

这篇关于我如何创建一个使用gtk读写行的textarea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆