- AuthorPosts
- March 25, 2015 at 11:37 pm #19948Leonard TsaiParticipant
Hi,
According the help, count property retrieves the number of selections in the current document. Here is my test:
x = document.selection.count;
Result:
x=0 if no seletion
x=0 if 1 selection, this should be wrong.
x=2 if 2 selectionsMarch 26, 2015 at 12:42 pm #19950Yutaka EmuraKeymasterHello,
This is actually not a bug, but it was not explained in the Help.
document.selection.count always returns 0 if EmEditor is not in the multiple selection mode.
It can be 1 when there is only one selection while it is in the multiple selection mode. For example, if you try to click at the same Cursor position while pressing CTRL key and move mouse and release the key. Or if there is only one word in a file and press CTRL + SHIFT + A, it should select the word and there will be only one selection.
It is important to distinguish between the normal selection mode and the multiple selection mode, so I will leave the behavior as it is, and will add more explanation to the Help.
Thank you!
March 29, 2015 at 6:55 pm #19957Leonard TsaiParticipantOk. I understood. But I’m thinking how to get top and bottom points of each selection in multiple selection mode. It seems that I can’t find any way which can achieve this. If there is one, I should see it in the description of selection object, right? However, I had better leave that in another thread.
March 29, 2015 at 8:55 pm #19960Yutaka EmuraKeymasterHello,
For the n’th selection, you can find the top and bottom position with the following method.
xTop = GetTopPointX( eePosLogical, n ); yTop = GetTopPointY( eePosLogical, n ); xBottom = GetBottomPointX( eePosLogical, n ); yBottom = GetBottomPointY( eePosLogical, n );
- AuthorPosts
- You must be logged in to reply to this topic.