List out of bounds Exception in TRVEditRVData.GetCurItemNo
-
- Posts: 42
- Joined: Wed Feb 28, 2007 4:14 am
List out of bounds Exception in TRVEditRVData.GetCurItemNo
Sergey, I've got one nasty bug - sometimes while drag'n'drop selected text I've got this exception.
I'm calling actions update on OnCaretMove event - and inside it I'm calling this function.
I'm making drag'n'drop in tables - and sometimes this bug happens.
Any ideas about that?
Michael.
I'm calling actions update on OnCaretMove event - and inside it I'm calling this function.
I'm making drag'n'drop in tables - and sometimes this bug happens.
Any ideas about that?
Michael.
-
- Posts: 42
- Joined: Wed Feb 28, 2007 4:14 am
Well, I think, that document in this case simply unformated - but why this happens, I couldn't say.
I made some modifications - don't know, am I right...
I made some modifications - don't know, am I right...
Code: Select all
function TRVEditRVData.GetCurItemNo: Integer;
{........................................}
function IndexOf(obj: TObject): Integer;
begin
if not Assigned(DrawItems) then
begin
Result := -1;
Exit;
end;
if CaretDrawItemNo > DrawItems.Count - 1 then
begin
Result := -1;
Exit;
end;
if DrawItems[CaretDrawItemNo].ItemNo > Items.Count - 1 then
begin
Result := -1;
Exit;
end;
if (CaretDrawItemNo>=0) and (Items.Objects[DrawItems[CaretDrawItemNo].ItemNo]=obj) then
Result := DrawItems[CaretDrawItemNo].ItemNo
else
Result := Items.IndexOfObject(obj);
end;
{........................................}
begin
PrepareForEdit;
if FPartialSelectedItem<>nil then
Result := IndexOf(FPartialSelectedItem)
else if GetChosenItem<>nil then
Result := IndexOf(GetChosenItem)
else if CaretDrawItemNo=-1 then
Result := -1
else
begin
if CaretDrawItemNo <= DrawItems.Count - 1 then
Result := DrawItems[CaretDrawItemNo].ItemNo
else
Result := -1;
end;
end;
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 42
- Joined: Wed Feb 28, 2007 4:14 am
-
- Posts: 42
- Joined: Wed Feb 28, 2007 4:14 am
-
- Posts: 42
- Joined: Wed Feb 28, 2007 4:14 am
Not sure, but with this code my actions started worked fine
Sergey, could this part solve my troubles for updating?
Best regards,
Michael.
Code: Select all
if (rvstEditorUnformatted in RvData.State) or (rvstMakingSelection in RvData.State)
or (rvstDeselecting in RvData.State) or (rvstStartingDragDrop in RvData.State) or
(rvstForceStyleChangeEvent in RvData.State) or (rvstLineSelection in RvData.State)
or (rvstClearing in RvData.State) then
Exit;
Best regards,
Michael.
-
- Posts: 42
- Joined: Wed Feb 28, 2007 4:14 am
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 42
- Joined: Wed Feb 28, 2007 4:14 am