首页 > 解决方案 > 如何在 ChUI 编辑器小部件中更改文本的外观

问题描述

我正在使用编辑器小部件来显示从文本文件中读取的 longchar 值。Linux 上的 OpenEdge 11.5 ChUI。

逻辑类似于以下内容:

def var mytext as longchar
init "Sample Text.  Sample Text.  Sample Text.".

form mytext view-as editor large inner-chars 30 inner-lines 15
scrollbar-horizontal scrollbar-vertical
with frame frame1 no-labels no-box.

view frame frame1.
display mytext with frame frame1.
mytext:read-only = yes.
enable mytext with frame frame1.
wait-for end-error of mytext.

当显示编辑器时,编辑器小部件中的文本被“突出显示”(即,以反向视频显示)。(见下面的截图。)

有没有办法在编辑器小部件中显示文本,使其不被“突出显示”?

在此处输入图像描述

标签: openedgeprogress-4gl

解决方案


我通常会这样做:

/* textedit.p
 *
 * a file viewer
 *
 */

define variable fileName as character no-undo format "x(30)".

define variable fileBody as longchar  no-undo.

fileName = "textedit.p".

file-info:file-name = fileName.
if file-info:full-pathname = ? then
  do:
    message "no such file:" fileName.
    pause.
    quit.
  end.

copy-lob from file file-info:full-pathname to fileBody.

display
  fileBody view-as editor inner-chars 160 inner-lines 52 large no-word-wrap
 with
  no-box
  no-labels
  color display normal prompt normal    /* this changes the coloring */
.

pause.

https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvref/color-phrase.html

如果你喜欢这种东西,你也可以摆弄框架和小部件属性。


推荐阅读