Вверх ↑
Разработчик
Ответов: 26113
Рейтинг: 2126
#1: 2020-11-30 22:47:18 ЛС | профиль | цитата
Замени код в компоненте MST_Virtual вот на этот

unit hiMST_Virtual;

interface

uses Windows, Kol, Share, Debug, hiMTStrTbl;

type
THIMST_Virtual = class(TDebug)
private
FMSTControl: IMSTControl;
DefPage: integer;
Page: integer;
FVirtIdx: integer;
oldPerPage: integer;
procedure InitPage;
procedure SetPage(Value: integer);
procedure SetMSTControl(Value: IMSTControl);
procedure _OnLVData(Sender: PControl; Idx, SubItem: Integer; var Txt: String; var ImgIdx: Integer;
var State: DWORD; var Store: Boolean);
public

_prop_SubItemName: byte;
_data_VirtIdx,
_data_Page,
_data_VirtualData: THI_Event;
_event_onChangeVirtIdx: THI_Event;

property _prop_MSTControl: IMSTControl read FMSTControl write SetMSTControl;
property _prop_DefaultPage: integer read DefPage write SetPage;
procedure _work_doNextPage(var _Data: TData; Index: word);
procedure _work_doPrevPage(var _Data: TData; Index: word);
procedure _work_doSetPage(var _Data: TData; Index: word);
procedure _work_doResetPage(var _Data: TData; Index: word);
procedure _work_doInitPage(var _Data: TData; Index: word);
procedure _work_doSetVirtIdx(var _Data: TData; Index: word);
procedure _var_CurPage(var _Data: TData; Index: word);
procedure _var_PerPage(var _Data: TData; Index: word);
procedure _var_CurVirtIdx(var _Data: TData; Index: word);
end;

implementation

procedure THIMST_Virtual.InitPage;
var
i, j: integer;
sControl: PControl;
ColCount, defPerPage: integer;
begin
if not Assigned(FMSTControl) then exit;
sControl := FMSTControl.ctrlpoint;
sControl.BeginUpdate;
ColCount := FMSTControl.clistcount;
if (sControl.Count <> 0) and (FMSTControl.clistcount <> 0) then
begin
if sControl.LVPerPage > oldPerPage then
begin
for i := 0 to sControl.LVPerPage - oldPerPage - 1 do
sControl.LVItemAdd('');
end
else if sControl.LVPerPage < oldPerPage then
begin
for i := sControl.LVPerPage to oldPerPage - 1 do
sControl.LVDelete(i);
end;
for i := 0 to sControl.LVPerPage - 1 do
begin
sControl.LVItemImageIndex[i]:= I_SKIP;
for j := 0 to ColCount - 1 do
sControl.LVItems[i, j] := '';
end;
oldPerPage := sControl.LVPerPage;
end;
sControl.EndUpDate;
_hi_onEvent(_event_onChangeVirtIdx, FVirtIdx);
end;

procedure THIMST_Virtual.SetPage;
begin
DefPage := Value;
Page := Value;
end;

procedure THIMST_Virtual.SetMSTControl;
var
sControl: PControl;
l: TListViewOptions;
i: integer;
begin
if Value = nil then exit;
FMSTControl := Value;
sControl := Value.ctrlpoint;
l := sControl.LVOptions;
if (lvoOwnerData in l) then
begin
sControl.OnLVData := _OnLVData;
for i := 0 to sControl.LVPerPage - 1 do
sControl.LVItemAdd('');
end;
FVirtIdx := Page * sControl.LVPerPage;
oldPerPage := sControl.LVPerPage;
end;

и попробуй вот эту схему

Схема

Add(Matrix,327698,896,301)
{
MatrixType=2
Point(Size)
link(Size,16351534:Point,[])
}
Add(MatrixRW,1592271,896,567)
{
Value=String()
Point(doClear)
link(onRead,8915826:doData,[(942,573)(942,552)(767,552)(767,573)])
link(Matrix,6724999:Var2,[])
link(X,10994896:Value3,[(916,558)(866,558)(866,611)(846,611)])
link(Y,10994896:Value2,[(923,558)(937,558)(937,628)(839,628)])
}
Add(MainForm,3063237,224,399)
{
Width=651
Height=550
Point(onMouseDown)
link(onCreate,16430040:doEvent1,[])
}
Add(StrList,4383086,511,399)
{
Point(EndIdx)
Point(doGetString)
Point(onGetString)
link(onGetString,625405:doEnum,[])
}
Add(ChildPanel,11085202,322,413)
{
link(onEvent2,9222564:doEvent1,[])
}
BEGIN_SDK
Add(EditMulti,7878121,21,21)
{
EventCount=2
WorkCount=1
Width=440
Height=270
link(doWork1,12297484:doEvent1,[(46,27)(46,97)])
}
Add(Panel,13137533,56,35)
{
Width=643
Height=30
Align=2
}
Add(Button,294400,42,126)
{
Left=15
Top=5
Caption="New"
link(onClick,12836985:doEvent1,[])
}
Add(Edit,10340021,217,35)
{
Left=185
Top=5
Width=90
Text="20000"
DataType=2
}
Add(Label,13731098,168,35)
{
Left=125
Top=7
Width=61
Height=17
Caption="Кол. строк"
}
Add(Button,11871194,238,175)
{
Left=290
Top=5
Caption="View"
link(onClick,1896552:doData,[])
}
Add(LED,11063149,301,49)
{
Left=80
Top=5
Width=20
Height=20
ColorOff=65280
}
Add(Hub,12297484,91,91)
{
OutCount=4
link(onEvent1,3301899:doWork2,[(116,97)(116,83)])
link(onEvent2,3210884:doWork1,[])
link(onEvent4,14611930:doWork2,[])
}
Add(MultiElement,3210884,217,98)
{
link(onEvent1,2339098:doAdd,[])
link(onEvent2,11063149:doOff,[(284,111)(284,62)])
link(Data1,10340021:Text,[])
}
BEGIN_SDK
Add(EditMulti,90280,28,21)
{
EventCount=2
WorkCount=2
DataCount=1
Width=636
Height=158
VOffset=7
HOffset=28
link(doWork1,15240120:doEvent1,[])
link(doWork2,15286128:doFor,[(39,41)(39,55)])
}
Add(For,15286128,49,49)
{
@Hint=#18:Количество абзацев|
IncludeEnd=1
link(onEvent,9486001:doRandom,[])
link(onStop,90280:onEvent2,[(88,62)(88,158)(603,158)(603,41)])
link(End,90280:Data1,[])
}
Add(For,11842154,154,49)
{
@Hint=#29:Количество слов в предложении|
link(onEvent,5410569:doText,[])
link(onStop,15892992:doEvent1,[(193,62)(193,97)])
link(End,1516465:Var3,[(167,40)(146,40)(146,89)])
}
Add(Random,9486001,105,49)
{
Min=7
Max=15
link(onRandom,11842154:doFor,[])
}
Add(InlineCode,5410569,203,42)
{
WorkPoints=#7:doStart|6:doText|
EventPoints=#5:onRes|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|21:uses kol,Share,Debug;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|0:|9: public|23: onRes : THI_Event;|5: |52: procedure doStart(var _Data:TData; Index:Word); |50: procedure doText(var _Data:TData; Index:Word);|5: end;|0:|14:implementation|0:|30:procedure THiAsmClass.doStart;|6: begin|12: Randomize;|5: end;|0:|29:procedure THiAsmClass.doText;|15:var sss:string;|16: i,j:integer;|16: _Rnd:double;|5:BEGIN|11: sss:=' ';|24: j:=round(Random*12)+2;|19: for i:=0 to j do|9: begin|18: _Rnd:=Random;|42: if _Rnd<0.0003 then sss:=sss+'ё' else|42: if _Rnd<0.0007 then sss:=sss+'ъ' else|42: if _Rnd<0.0033 then sss:=sss+'ф' else|42: if _Rnd<0.0065 then sss:=sss+'э' else|42: if _Rnd<0.0101 then sss:=sss+'щ' else|42: if _Rnd<0.0149 then sss:=sss+'ц' else|42: if _Rnd<0.0213 then sss:=sss+'ю' else|42: if _Rnd<0.0286 then sss:=sss+'ш' else|41: if _Rnd<0.038 then sss:=sss+'ж' else|42: if _Rnd<0.0477 then sss:=sss+'х' else|42: if _Rnd<0.0598 then sss:=sss+'й' else|42: if _Rnd<0.0742 then sss:=sss+'ч' else|42: if _Rnd<0.0901 then sss:=sss+'б' else|42: if _Rnd<0.1066 then sss:=sss+'з' else|42: if _Rnd<0.1236 then sss:=sss+'г' else|41: if _Rnd<0.141 then sss:=sss+'ь' else|40: if _Rnd<0.16 then sss:=sss+'ы' else|42: if _Rnd<0.1801 then sss:=sss+'я' else|42: if _Rnd<0.2063 then sss:=sss+'у' else|42: if _Rnd<0.2344 then sss:=sss+'п' else|42: if _Rnd<0.2642 then sss:=sss+'д' else|42: if _Rnd<0.2963 then sss:=sss+'м' else|42: if _Rnd<0.3312 then sss:=sss+'к' else|42: if _Rnd<0.3752 then sss:=sss+'л' else|42: if _Rnd<0.4206 then sss:=sss+'в' else|42: if _Rnd<0.4679 then sss:=sss+'р' else|42: if _Rnd<0.5226 then sss:=sss+'с' else|42: if _Rnd<0.5852 then sss:=sss+'т' else|42: if _Rnd<0.6522 then sss:=sss+'н' else|42: if _Rnd<0.7257 then sss:=sss+'и' else|42: if _Rnd<0.8058 then sss:=sss+'а' else|42: if _Rnd<0.8903 then sss:=sss+'е' else|34: if _Rnd<1 then sss:=sss+'о'; |9: end;|25: _hi_onEvent(onRes,sss);|4:END;|0:|0:|4:end.|
link(onRes,15879034:doWork2,[])
}
Add(StrCat,13455235,308,42)
{
Point(doClear)
link(Str1,7063167:Var3,[(314,33)(328,33)(328,82)])
}
Add(Hub,15240120,70,28)
{
link(onEvent1,5410569:doStart,[(193,34)(193,48)])
link(onEvent2,9486001:doRandomize,[(95,41)(95,62)])
}
Add(DoData,7170534,308,98)
{
link(onEventData,16600547:doTrim,[])
link(Data,7063167:Var2,[])
}
Add(GetDataEx,7063167,308,77)
{
link(Data,13455235:Result,[])
}
Add(Hub,15892992,203,91)
{
OutCount=3
link(onEvent1,7526937:doData,[(242,97)(242,62)])
link(onEvent2,7170534:doData,[])
link(onEvent3,13455235:doClear,[(298,111)(298,55)])
}
Add(DoData,7526937,252,56)
{
Data=String(. )
link(onEventData,15879034:doWork3,[(291,62)])
}
Add(HubEx,15879034,287,42)
{
link(onEvent,13455235:doStrCat,[])
}
Add(StrCase,14266070,406,98)
{
Type=3
link(onModify,131368:doString,[])
}
Add(Trim,16600547,357,98)
{
Char=" "
Mode=4
link(onTrim,14266070:doModify,[])
}
Add(FormatStr,131368,469,98)
{
DataCount=3
Mask="%1;%2;%3"
link(onFString,90280:onEvent1,[(508,104)(508,34)])
link(Str1,15286128:Position,[(475,89)(461,89)(461,138)(55,138)])
link(Str3,1516465:Var2,[(489,82)(349,82)(349,124)(111,124)])
}
Add(GetDataEx,1516465,105,84)
{
link(Data,9486001:Random,[])
}
END_SDK
Add(Hub,12836985,91,126)
{
OutCount=3
link(onEvent1,3301899:doWork3,[(123,132)])
link(onEvent3,14611930:doWork3,[(130,146)])
}
Add(HubEx,3301899,119,77)
{
link(onEvent,16463242:doEvent1,[])
}
Add(StrList,2339098,301,98)
{
Point(doSave)
}
Add(DoData,1896552,301,175)
{
link(onEventData,7878121:onEvent2,[(360,181)(360,34)])
link(Data,2339098:Text,[])
}
Add(HubEx,14611930,126,112)
{
Angle=3
link(onEvent,3646847:doStart,[(130,111)])
}
Add(Hub,16463242,238,77)
{
link(onEvent1,11063149:doOn,[(291,83)(291,69)])
link(onEvent2,2339098:doClear,[(291,90)(291,111)])
}
Add(Thread,3646847,161,105)
{
Delay=20
FastStop=0
link(onExec,3210884:doWork2,[])
}
Add(Edit,12435698,291,228)
{
Left=475
Top=5
Width=90
Text="Поиск"
DataType=2
link(onEnter,7878121:onEvent1,[(340,241)(340,27)])
}
END_SDK
Add(MST_Virtual,15555683,777,658)
{
MSTControl="MTStrTbl"
Point(doInitPage)
Point(doSetVirtIdx)
link(onChangeVirtIdx,4071568:doEvent1,[])
link(VirtualData,8915826:GetData,[])
}
Add(MathParse,4883725,455,686)
{
MathStr="(%2 - sign(%1) * 3) * ((%2 - sign(%1) * 3) >= 0)"
ResultType=0
link(onResult,5531226:doCompare,[])
link(X2,9756559:Var1,[(468,677)(552,677)(552,726)])
}
Add(If_else,5531226,504,686)
{
Type=1
link(onTrue,14213054:doWork2,[])
link(Op2,4383086:Count,[(517,446)(524,446)])
}
Add(EventFromData,8915826,777,567)
{
link(onEvent,10994896:doValue,[])
}
Add(For,8901862,889,665)
{
link(onEvent,7765738:doOperation,[])
link(End,7882432:Var3,[(902,656)(881,656)(881,719)])
}
Add(Hub,4071568,826,658)
{
link(onEvent1,1592271:doClear,[(872,664)(872,587)])
link(onEvent2,8901862:doFor,[])
}
Add(Math,7765738,945,665)
{
ResultType=0
link(onResult,4383086:doGetString,[(991,671)(991,734)(501,734)(501,433)])
link(Op1,9756559:Var3,[(951,656)(937,656)(937,726)])
}
Add(Hub,9222564,399,420)
{
OutCount=3
link(onEvent1,4383086:doText,[])
link(onEvent2,1551736:doData,[(479,433)(479,475)])
link(onEvent3,15504297:doEvent2,[(424,440)(424,342)])
}
Add(MTStrTbl,7148080,875,133)
{
Top=30
Width=615
Height=481
Align=5
Name="MTStrTbl"
Columns=#4:1=50|5:2=500|4:3=59|
VirtualTab=0
Point(onMouseWheel)
Point(PerPage)
Point(onResize)
Point(onMouseDown)
Point(doStyle)
link(onMouseWheel,171554:doWork2,[])
link(onResize,15504297:doEvent1,[(921,174)(921,223)(844,223)(844,335)])
}
Add(MT_MultiMem,10994896,826,567)
{
Count=3
link(onData,1592271:doRead,[])
}
Add(PointXY,16351534,896,245)
{
link(X,7148080:CountCol,[])
link(Y,7148080:PerPage,[])
}
Add(Str_Enum,625405,924,406)
{
From=0
link(onEnum,7441290:doWrite,[])
}
Add(MatrixRW,7441290,973,399)
{
Point(doClear)
link(Matrix,6724999:Var3,[(979,362)])
link(X,625405:NumSubStr,[(993,390)(965,390)(965,446)(930,446)])
link(Y,8901862:Position,[(1000,390)(1014,390)(1014,705)(895,705)])
}
Add(ScrollBar,16623256,588,462)
{
Left=615
Top=30
Width=20
Height=481
Align=3
Kind=1
Point(doMax)
Point(doPage)
link(onPosition,14213054:doWork1,[(627,468)])
}
Add(DoData,1551736,532,469)
{
link(onEventData,16623256:doMax,[])
link(Data,4383086:EndIdx,[])
}
Add(HubEx,14213054,623,686)
{
link(onEvent,1693440:doEvent1,[])
}
Add(Hub,15504297,854,329)
{
InCount=2
link(onEvent1,327698:doSize,[(872,335)(872,307)])
link(onEvent2,171554:doWork3,[(970,342)])
}
Add(HubEx,171554,966,161)
{
link(onEvent,8308093:In,[])
}
Add(GetDataEx,9756559,777,721)
{
link(Data,15555683:CurVirtIdx,[])
}
Add(LineBreak,3144940,406,686)
{
link(Out,4883725:doCalc,[])
Primary=[8308093,574,-525]
}
Add(GetDataEx,6724999,896,357)
{
link(Data,327698:Matrix,[])
}
Add(ChangeMon,13251618,707,658)
{
link(onData,15555683:doInitPage,[(760,664)(760,692)])
link(Data,7882432:Var1,[(713,649)(643,649)(643,719)])
}
Add(Hub,16430040,273,413)
{
link(onEvent1,11085202:doWork1,[])
}
Add(GetDataEx,7882432,791,714)
{
link(Data,15555683:PerPage,[])
}
Add(Hub,1693440,651,686)
{
link(onEvent1,13251618:doData,[(676,692)(676,664)])
link(onEvent2,15555683:doSetVirtIdx,[])
}
карма: 22

0
Редактировалось 2 раз(а), последний 2020-11-30 22:48:27