我正在尝试使用以下代码动态创建一组按钮:
DEFINE VAR temp-hand AS WIDGET-HANDLE.
DEFINE INPUT PARAMETER ipc AS CHARACTER NO-UNDO.
&global-define X VALUE(v + ipc )
CREATE BUTTON temp-hand
ASSIGN
FRAME = FRAME btn-frame:HANDLE
ROW = vdeInicio
COLUMN = 10
WIDTH = 19
LABEL = ipc
SENSITIVE = TRUE
VISIBLE = TRUE
TRIGGERS:
ON CHOOSE PERSISTENT RUN btn-mess IN THIS-PROCEDURE.
END TRIGGERS.
temp-hand:LOAD-IMAGE("imagenes/Entradas").
vdeInicio = vdeInicio + 3.57.
当我处理单个按钮小部件时,这也有效,如果写一个循环并使用此代码调用一个过程,它会创建多个按钮但指向一个句柄,有些人告诉我,而不是创建一个临时表并保存在那里小部件句柄可能有效,但我不知道如何使用小部件句柄填充表格,你能帮我解决这个问题,
答案 0 :(得分:2)
这样的事情:
define temp-table tt_buttonList no-undo
field buttonId as integer
field buttonHandle as widget-handle
.
define variable i as integer no-undo.
do i = i to 5:
create tt_buttonList.
tt_buttonList.buttonId = i.
CREATE BUTTON tt_buttonList.buttonHandle
ASSIGN FRAME = FRAME btn-frame:HANDLE /* this is undefined in your example -- I have no idea where it came from */
ROW = i * 4
COLUMN = 10
WIDTH = 19
LABEL = string( i )
SENSITIVE = TRUE
VISIBLE = TRUE
.
end.
我不知道为什么你会从触发器程序中运行这样的代码。虽然它可能“有效”,但将UI混合到数据库访问代码中是非常麻烦的。