Page 1 of 1
Call GetSelectionBounds from OnItemAction
Posted: Wed Oct 27, 2010 10:17 am
by vit
Hi!
Sometimes I get exception when I try to call GetSelectionBounds from OnItemAction event handler. So I have 2 questions:
1. It is allowably to call GetSelectionBounds from OnItemAction?
2. How can I determine is document formatted?
Thank you!
Posted: Wed Oct 27, 2010 1:00 pm
by Sergey Tkachenko
No, you cannot use methods related to selection from this event, because document can be unformatted and even half-created.
Sorry, there is no way to guarantee that the document is formatted.
Posted: Fri Oct 29, 2010 10:49 am
by vit
Sergey Tkachenko wrote:document can be unformatted and even half-created.
I guess that doc can be half-created while it is loading? Or not only?
Posted: Tue Nov 02, 2010 3:44 pm
by Sergey Tkachenko
When this event informs about item insertion, this insertion may be done in many ways, including file cleared.
Similarly, deletion may means that the document is being loaded.
In these cases, document may be half-created or half-destroyed when this event is called.
And in the most cases, this event is called then the document is not formatted, so it is not ready to be displayed, modified, and its selection cannot be accessed.
Posted: Fri Nov 05, 2010 7:47 am
by vit
Ok.
I'm going to do the next.
1. When ItemAction = rviaInserting in OnItemAction event handler I will put Item into the TObjectList. Then I will post some message to the form.
2. Also I will add item deletion processing to OnItemAction to exclude item from TObjectList.
3. In message handler I will get Item from TObjectList.
So can I be sure that in message handler Item will not be freed?
Posted: Fri Nov 05, 2010 9:23 am
by Sergey Tkachenko
If you use PostMessage, and quickly add and delete item, a message will be processed after deletion.