Page 1 of 1
Clicking a table cell causes OnItemAction to fire
Posted: Sat Mar 11, 2006 11:57 pm
by aoven
I noticed that OnItemAction fires with ItemAction = rviaInserting when clicking inside a cell if caret was previously outside.
I figure this happens because of the trick with a nested inplace editor, which comes transparently to life when a cell is being edited. However, for all practical purposes this is a false event. It shouldn't fire if insertion is a result of an internal inplace editor creation.
Can it be fixed? If not, what can I do to detect when OnItemAction is being triggered by a valid change in the editor and when it's a false alarm?
Posted: Sun Mar 12, 2006 7:15 pm
by aoven
After digging through the source, I found a way to detect the situation. In OnItemAction I check Sender.Focused value. If it's False, then the event is a result of inplace editor being filled with cell contents. If it's True, then it's a genuine event.
The question remains if this check will still work with the next RV version. Is this likely to change, Sergey?
Posted: Mon Mar 13, 2006 8:28 am
by Sergey Tkachenko
Calling this event in this case is by design - items are informed that their parent RVData is changed (cell -(editing)-> inplaceeditor and back).
I am not sure about the Focused property, may be it is False by accident.
How do you use this event? If you maintain a list of inserted items (of some type), you can check if they were already inserted.
Posted: Wed Jun 21, 2006 8:32 am
by Pieter E.
Dear Sergey,
I found the same problem when a picture is nested in a table the rviaInserted is used while the picture isn't inserted by the user.
I use the following sourceparts:
Code: Select all
rve->RVFOptions = rve->RVFOptions >> rvfoSavePicturesBody >> rvfoSaveBack;
ONRVFPictureNeeded event for loading images from the harddisc and internet.
And the rviaInserted in the OnItemAction for saving some picture properties to a file.
Could you please advise me what to do?
Thanks.
Posted: Wed Jun 21, 2006 8:50 pm
by Sergey Tkachenko
?
OnItemAction with rviaInserted is called when the item is already inserted in the list of items of RVData, and its index in this list is known.
Posted: Thu Jun 22, 2006 6:21 am
by Pieter E.
When I insert a picture the 'rviaInserted' is used. Like it should be. But when I select a picture which is nested in a table the 'rviaInserted' is also used. When a picture is outside a table and I select it, the 'rviaInserted' is not used.
Try it out adding a 'messagebox' in the 'rviaInserted'.
Posted: Thu Jun 22, 2006 3:37 pm
by Sergey Tkachenko
"Inserted" is called every time when the item is moved to another document (i.e. another RVData). This includes moving to cell inplace editor and back to the cell (it happens on selection).
So it is by design.
Posted: Thu Jun 22, 2006 3:56 pm
by Pieter E.
I understand. Is there a way to recognize if a picture is nested in a table? My application uses 'rviaInserted' for recognizing new added pictures. A picture which already is inserted shouldn't be recognized.
Posted: Thu Jun 22, 2006 4:02 pm
by Sergey Tkachenko
The most reliable way is checking if this image is already in the list.