namespace com; var dll = ..raw.loadDll( ..io.appData("aardio/std/com/autoComplete.dll",$"~/lib/com/autoComplete/.res/autoComplete.dll") ,,"cdecl"); class autoComplete{ ctor(edit,option,format){ var hwnd = edit[["hwnd"]]; if(!hwnd) error("参数请指定 edit 控件对象",2); if(edit.editBox){ hwnd = edit.editBox.hwnd; } var objPtr = dll.CreateIDispatchObjectP(hwnd,option||(1|2|0x20|0x10)); this = ..com.QueryObjectR(objPtr); edit._onDestroy_stdReserved__ = function(){ this.delete();//此函数不能重复调用 this.delete = function(){} } this[["hide"]] = function(){ this.enable(false); this.enable(true); } edit.onOk = function(){ this.hide(); } }; } //@guide [🅰 使用范例](doc://example/Windows/edit/autoComplete.html) [📄 autoComplete.dll 源码](doc://example/Languages/CPP/com.autoComplete.html) /*****intellisense() com.autoComplete = 自动完成接口 com.autoComplete( = 创建自动完成对象 com.autoComplete(.(edit,option) = 参数 @edit 指定 edit 控件对象(或启用编辑模式的 plus 控件)。\n参数 @option 可选用数值指定默认选项,可用选项请参考 setOption 函数说明。\n一般不需要指定 @option 。 com.autoComplete() = !stdComAomplete. end intellisense*****/ /*****intellisense(!stdComAomplete) setOption(__) = 使用参数 @1 指定一个数值更新自动完成选项。\n可用选项请参考[文档](https://learn.microsoft.com/windows/win32/api/shldisp/ne-shldisp-autocompleteoptions)\n一般没必要修改 option 。 enable(__) = 启用或禁用自动完成,使用参数 @1 可指定 true 或 false 。 setStrings(__/*字符串数组*/) = 将参数 @1 指定的字符串数组设置为 edit 控件的自动完成列表。\n必须在用户输入前设置好所有需要提示的字符串,如果正在输入时变更字符串列表不会实时生效。 hide() = 临时隐藏自动完成列表。\n调用此函数后会启用自动完成功能。\n默认会在回车时调用此功能。 end intellisense*****/