问两个问题:
1、在数据窗口中可以用dw_1.getitemstring(row,dwo.name)取得字符型值,但如果字段名字段类型都不能确定的情况下如何取值?
2、在单行编辑框中放置字符型默认值后,如果要将光标置于这个字符串之后,那个函数是什么来的?
------解决方案--------------------
1.可以使用dw.object.column[row]來取值
2.好像是selecttext吧
------解决方案--------------------
1、你得先明确你知道什么信息,你想要获取什么信息
dw_1.object.data[1, 2] //取第1行,第2列的值
dw_1.getitemstring(1, 2) //取第1行,第2列的值(字符串型的,其他类似)
2、sle_1.selecttext(1000, 1)
------解决方案--------------------
可以通过dwo.name取得列的类型,再用对应的取值函数:
String ls_ColType,ls_val
Long ll_val
Decimal ldc_val
Datatime ldtt_val
ls_ColType = Describe(dwo.name+".ColType")
if Pos(Lower(ls_ColType),"char")<>0 then
ls_val = GetItemString(row,dwo.name)
elseif Pos(Lower(ls_ColType),"decimal")<>0 then
ldc_val = GetItemDecimal(row,dwo.name)
elseif Pos(Lower(ls_ColType),"number")<>0 Or Pos(Lower(ls_ColType),"real")<>0 then
ll_val = GetItemNumber(row,dwo.name)
elseif Pos(Lower(ls_ColType),"datetime")<>0 then
ldtt_val = GetItemDatetime(row,dwo.name)
/*...*/
end if
------解决方案--------------------
String ls_ColType,ls_val
Long ll_val
Decimal ldc_val
Datatime ldtt_val
ls_ColType = LEFT(Describe(dwo.name+".ColType"),4)
CHOOSE CASE ls_ColType
CASE "char","char(" //考虑计算域
s_val = GetItemString(row,dwo.name)
CASE "decim"
ldc_val = GetItemDecimal(row,dwo.name)
CASE "numbe","real"
ll_val = GetItemNumber(row,dwo.name)
CASE "datet"
ldtt_val = GetItemDatetime(row,dwo.name)
//其他类型自己扩充
END CHOOSE
------解决方案--------------------