How can i create a textarea that has read and write lines using gtk

為{幸葍}努か 提交于 2019-12-25 05:03:15

问题


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.


回答1:


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:

  • creating the tag
  • applying the tag


来源:https://stackoverflow.com/questions/19242200/how-can-i-create-a-textarea-that-has-read-and-write-lines-using-gtk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!