我正在使用Progress 4gl并尝试动态更改列标签,这是可能的

时间:2012-12-06 14:47:12

标签: progress-4gl openedge

我尝试了以下代码:

def temp-table tt-dg1
    field dtoday as date column-label "dg "
    .

buffer tt-dg1:BUFFER-FIELD("dtoday"):
column-LABEL = buffer tt-dg1:BUFFER-FIELD("dtoday"):column-LABEL + "77".

display buffer tt-dg1:BUFFER-FIELD("dtoday"):column-LABEL.

create tt-dg1.
dtoday = today.

display tt-dg1 with frame f2.

期望字段dtoday现在的列标签为dg 77,但它仍为dg,我需要将此周数添加到标准列标签中我正在创建的电子表格。

感激不尽的任何帮助:)

2 个答案:

答案 0 :(得分:0)

这感觉就像一个错误。 在覆盖临时表时,它似乎不起作用。

如果您在显示之前在一个框架中定义了字段,那么您可以在那里覆盖它。

form tt-dg1.dtoday with frame f2.
tt-dg1.dtoday:label = "MyLabel".
display tt-dg1.dtoday with frame f2.

取决于你在做什么,这可能有所帮助。

答案 1 :(得分:0)

是否可以动态创建临时表?如果是这样,你可以在那里动态设置

DEFINE VARIABLE ttDynTable AS HANDLE NO-UNDO.
DEFINE VARIABLE vInt       AS INTEGER NO-UNDO INIT 77.

CREATE TEMP-TABLE ttDyntable.
ttDynTable:ADD-NEW-FIELD('dtoday', 'DATE', 0, "99/99/9999",?,"","dg " + STRING(vInt)).
ttDynTable:TEMP-TABLE-PREPARE("tt-dg1").

ttTTHandle = ttDyntable:DEFAULT-BUFFER-HANDLE.
ttTTHandle:BUFFER-CREATE.
ttTTHandle::dtoday = TODAY.

DISPLAY ttTTHandle:buffer-field('dtoday'):column-label ttTTHandle::dtoday.

如果不是,你可以从缓冲区中拉出列标签

DEFINE TEMP-TABLE tt-dg1 FIELD dtoday AS DATE   COLUMN-LABEL "dg ". 
DEFINE VARIABLE   vTTHandle           AS HANDLE NO-UNDO.
CREATE tt-dg1.
dtoday = TODAY.

vTTHandle = BUFFER tt-dg1:HANDLE.
vTTHandle:BUFFER-FIELD("dtoday"):column-LABEL = vTTHandle:BUFFER-FIELD("dtoday"):column-LABEL + "77".

DISPLAY vTTHandle:BUFFER-FIELD('dtoday'):COLUMN-LABEL.