line 16 error: 'Dlg.control(...).GetItemByName(...).checked' (0x800a0005)
Option Explicit
Function OnClick(ByRef clickData)
dim Dlg, Msg, str
Set Dlg = DOpus.Dlg
Dlg.window = clickData.func.sourcetab
Dlg.template = "dialog1"
Dlg.detach = True
Dlg.Show
Do
Set Msg = Dlg.GetMsg()
if Msg.Event = "click" and Msg.control = "button1" then
str = "scriptadd" & Random(1,100)
Dlg.Control("listview1").AddItem str, 1
dopus.output Dlg.Control("listview1").GetItemByName(str).name
dopus.output "checked = " & Dlg.Control("listview1").GetItemByName(str).checked
Dlg.Control("listview1").GetItemByName(str).checked = true
end if
Loop While Msg
End Function
function Random(nLow, nHigh)
Randomize
Random = Int((nHigh - nLow + 1) * Rnd + nLow)
End function
<resources>
<resource name="dialog1" type="dialog">
<dialog fontsize="8" height="186" lang="english" width="144">
<control checkboxes="auto" height="156" name="listview1" type="listview" viewmode="list" width="132" x="6" y="24">
<contents>
<item text="桔子" />
<item text="苹果" />
<item text="香蕉" />
</contents>
</control>
<control height="14" name="button1" title="按钮" type="button" width="50" x="12" y="6" />
</dialog>
</resource>
</resources>