Тестовая схема:
Add(MainForm,10809136,154,126)
{
Width=778
Height=582
Position=1
Point(onKeyDown)
link(onCreate,10041622:doEnum,[])
}
Add(MTStrTbl,5133893,343,126)
{
Left=5
Top=5
Width=752
Height=433
Font=[MS Sans Serif,12,0,0,1]
WinStyle=4
Name="testTable"
Columns=#4:№=40|9:Фильм=200|9:Год=60==2|11:Жанр=200==2|12:Описание=300|0:|
CheckBoxes=0
Grid=0
}
Add(StrList,15034837,196,84)
{
Strings=#49:1;Звездные войны;1980;фантастика;Фильм о войнах )|32:2;1+1;2003;комедия;Фильм о двух |39:3;Убить Билла;1990;боевик;Убивают Билла|53:4;Крепкий орешик 2;1999;боевик;Встретил жену с работы|52:5;Куб;1993;фантастика;Для любителей трехмерных фигур|48:6;Аватар;2004;фантастика;Управляют синими телами|
}
Add(MT_String,922736,259,126)
{
link(onResult,2904434:doRowAction,[])
}
Add(ArrayEnum,10041622,210,140)
{
link(onItem,922736:doMTString,[])
link(onEndEnum,14792267:doData,[(249,153)(249,195)])
link(Array,15034837:Array,[])
}
Add(MST_RowAction,2904434,301,126)
{
MSTControl="testTable"
}
Add(Button,4370717,385,294)
{
Left=340
Top=445
Width=90
Height=40
Font=[MS Sans Serif,12,0,0,1]
Caption="Вверх"
link(onClick,10277927:doRowAction,[])
}
Add(Button,13202419,385,350)
{
Left=340
Top=495
Width=90
Height=40
Font=[MS Sans Serif,12,0,0,1]
Caption="Вниз"
link(onClick,2072383:doRowAction,[])
}
Add(MST_RowAction,10277927,441,294)
{
Action=8
MSTControl="testTable"
Point(Index)
link(Index,12943451:Var2,[])
}
Add(MST_RowAction,2072383,427,350)
{
Action=9
MSTControl="testTable"
Point(Index)
link(Index,12943451:Var1,[(433,264)])
}
Add(MST_SelectRow,15300888,434,189)
{
MSTControl="testTable"
}
Add(DoData,14792267,259,189)
{
Data=Integer(2)
link(onEventData,730855:doEvent1,[])
AddHint(-1,-20,21,13,Data)
}
Add(MST_CheckBoxes,9803949,392,231)
{
MSTControl="testTable"
}
Add(Hub,730855,315,189)
{
link(onEvent1,15300888:doSelect,[])
link(onEvent2,14797827:doAdd,[(336,202)(336,237)])
}
Add(MT_Add,14797827,343,231)
{
Data=Integer(1)
link(onAdd,9803949:doCheckBox,[])
AddHint(0,-23,21,13,Data)
}
Add(GetDataEx,12943451,441,259)
{
link(Data,15300888:Index,[])
}
// Сдвигает строку вверх
// ARG(IndexRow)
//
procedure THIMST_RowAction._work_doRowAction8;
var
sControl: PControl;
dt, di: TData;
oldindex: integer;
cbState: integer;//fix sla8a 24.12.2024 update checkbox
begin
if not Assigned(_prop_MSTControl) then exit;
sControl := _prop_MSTControl.ctrlpoint;
oldindex := ReadInteger(_Data, _data_Index, _prop_Index);
if (oldindex <= 0) or (oldindex > sControl.Count - 1) then exit;
dtNull(dt);
dtNull(di);
oldindex := sControl.LVCurItem;
cbState := sControl.LVItemStateImgIdx[oldindex];//fix sla8a 24.12.2024 update checkbox
dt := _prop_MSTControl.getstring(oldindex);
dtInteger(di, oldindex - 1);
di.ldata := @dt;
_prop_MSTControl.actionitm(di, ITM_INSERT);
inc(oldindex);
if Assigned(PData(sControl.LVItemData[oldindex])) then
begin
FreeData(PData(sControl.LVItemData[oldindex]));
Dispose(PData(sControl.LVItemData[oldindex]));
end;
sControl.LVDelete(oldindex);
sControl.LVCurItem := oldindex - 2;
sControl.LVItemStateImgIdx[oldindex - 2] := cbState;//fix sla8a 24.12.2024 update checkbox
_hi_onEvent(_event_onChange, sControl.LVCurItem);
end;
// Сдвигает строку вниз
// ARG(IndexRow)
//
procedure THIMST_RowAction._work_doRowAction9;
var
sControl: PControl;
dt, di: TData;
oldindex: integer;
cbState: integer;//fix sla8a 24.12.2024 update checkbox
begin
if not Assigned(_prop_MSTControl) then exit;
sControl := _prop_MSTControl.ctrlpoint;
oldindex := ReadInteger(_Data, _data_Index, _prop_Index);
if (oldindex < 0) or (oldindex >= sControl.Count - 1) then exit;
dtNull(dt);
dtNull(di);
oldindex := sControl.LVCurItem;
cbState := sControl.LVItemStateImgIdx[oldindex];//fix sla8a 24.12.2024 update checkbox
dt := _prop_MSTControl.getstring(oldindex);
dtInteger(di, oldindex + 2);
di.ldata := @dt;
_prop_MSTControl.actionitm(di, ITM_INSERT);
if Assigned(PData(sControl.LVItemData[oldindex])) then
begin
FreeData(PData(sControl.LVItemData[oldindex]));
Dispose(PData(sControl.LVItemData[oldindex]));
end;
sControl.LVDelete(oldindex);
sControl.LVCurItem := oldindex + 1;
sControl.LVItemStateImgIdx[oldindex + 1] := cbState;//fix sla8a 24.12.2024 update checkbox
_hi_onEvent(_event_onChange, sControl.LVCurItem);
end;