代码拉取完成,页面将自动刷新
unit LuaCheckListBox;
{$mode delphi}
interface
uses
Classes, SysUtils, controls, CheckLst, betterControls;
procedure initializeLuaCheckListbox;
implementation
uses LuaListbox, luahandler, luaclass, lua;
function createCheckListBox(L: Plua_State): integer; cdecl;
var
CheckListBox: TCheckListBox;
parameters: integer;
owner: TWincontrol;
begin
result:=0;
parameters:=lua_gettop(L);
if parameters>=1 then
owner:=lua_toceuserdata(L, -parameters)
else
owner:=nil;
lua_pop(L, lua_gettop(L));
CheckListBox:=TCheckListBox.Create(owner);
if owner<>nil then
CheckListBox.Parent:=owner;
luaclass_newClass(L, CheckListBox);
result:=1;
end;
function checklistbox_getChecked(L: PLua_State): integer; cdecl;
var
checklistbox: TCustomCheckListBox;
index: integer;
begin
result:=0;
checklistbox:=luaclass_getClassObject(L);
if lua_gettop(L)=1 then
begin
index:=lua_toInteger(L, 1);
lua_pushboolean(L, checklistbox.Checked[index]);
result:=1;
end;
end;
function checklistbox_setChecked(L: PLua_State): integer; cdecl;
var
checklistbox: TCustomCheckListBox;
index: integer;
begin
result:=0;
checklistbox:=luaclass_getClassObject(L);
if lua_gettop(L)=2 then
begin
index:=lua_toInteger(L, 1);
checklistbox.Checked[index]:=lua_toboolean(L, 2);
end;
end;
procedure checklistbox_addMetaData(L: PLua_state; metatable: integer; userdata: integer );
begin
listbox_addMetaData(L, metatable, userdata);
luaclass_addArrayPropertyToTable(L, metatable, userdata, 'Checked', checklistbox_getChecked, checklistbox_setChecked);
end;
procedure initializeLuaCheckListbox;
begin
lua_register(LuaVM, 'createCheckListBox', createCheckListBox);
end;
initialization
luaclass_register(TCustomCheckListBox, checklistbox_addMetaData);
end.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。