To get/set attributes and call methods, try:
form with frame f1 title "Frame 1".
def var c1 as char view-as combo-box inner-lines 10.
function f_attribute returns char (
inp_inhandle as char,
h_inhandle as handle,
inp_attr as char,
inp_action as char,
inp_param as char,
inp_type as char,
inp_datatype as char):
define variable call_action as int no-undo.
define variable hCall as handle no-undo.
define variable return_attr as char no-undo.
define variable param_loop as int no-undo.
define variable param_type as char no-undo.
define variable param_datatype as char no-undo.
if inp_action = "get" then call_action = get-attr-call-type.
if inp_action = "set" then call_action = set-attr-call-type.
create call hCall.
if inp_inhandle <> "" then hCall:in-handle = inp_inhandle no-error.
else if valid-handle(h_inhandle) then hcall:in-handle = h_inhandle.
hcall:call-type = call_action.
hCall:call-name = inp_attr.
if hcall:call-name = inp_attr then do:
hCall:NUM-PARAMETERS = num-entries(inp_param,"|").
do param_loop = 1 to num-entries(inp_param,"|"):
if param_loop <= num-entries(inp_type,"|") then
param_type = entry (param_loop,inp_type,"|").
else
param_type = "char".
if param_loop <= num-entries(inp_datatype,"|") then
param_datatype = entry (param_loop,inp_datatype,"|").
else
param_datatype = "input".
hCall:set-parameter( param_loop, param_type, param_datatype, entry (param_loop,inp_param,"|")).
end.
hCall:invoke no-error.
return_attr = hCall:return-value.
delete object hcall.
return return_attr.
end.
else return "".
end function.
display c1 with frame f1.
f_attribute ("session", ?, "numeric-format", "set","american", "","").
message
f_attribute ("session", ?, "date-format", "get", "", "","") skip
f_attribute ("session", ?, "numeric-format", "get", "", "","") skip
f_attribute ("", frame f1:handle, "title", "get", "", "","") skip
f_attribute ("this-procedure", ?, "get-signature", "get","f_attribute", "","") skip(1)
view-as alert-box.
/* To show two parameters - equivalent to c1:insert ("One",1). */
f_attribute ("", c1:handle in frame f1, "insert", "get","One|1", "character|integer","").
f_attribute ("", c1:handle in frame f1, "insert", "get","Two|2", "character|integer","").
f_attribute ("", c1:handle in frame f1, "insert", "get","Three|3", "character|integer","").
update c1 with frame f1.