Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19948
    Leonard Tsai
    Participant

    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 selections

    #19950
    Yutaka Emura
    Keymaster

    Hello,

    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!

    #19957
    Leonard Tsai
    Participant

    Ok. 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.

    #19960
    Yutaka Emura
    Keymaster

    Hello,

    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 );
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.