Last active
April 27, 2021 12:20
-
-
Save tablacus/53d6cbc7df60f52c1f77b0e25611c8e3 to your computer and use it in GitHub Desktop.
Jump to the boundary between files and folders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var FV = GetFolderView(Ctrl,pt); | |
var Items = FV.Items(); | |
var bFolder = !IsFolderEx(Items.Item(0)); | |
var nCount = Items.Count; | |
var nIndex = Math.floor((nCount - 1) / 2); | |
var nDiff = nIndex; | |
while (nDiff) { | |
if (bFolder ^ IsFolderEx(Items.Item(nIndex))) { | |
nIndex += nDiff; | |
} else { | |
nIndex -= nDiff; | |
} | |
nDiff = Math.floor(nDiff / 2); | |
} | |
while (bFolder ^ IsFolderEx(Items.Item(nIndex))) { | |
if (nIndex++ >= nCount) { | |
break; | |
}; | |
} | |
FV.SelectItem(Items.Item(nIndex), SVSI_SELECT | SVSI_DESELECTOTHERS | SVSI_ENSUREVISIBLE | SVSI_FOCUSED); |
Author
tablacus
commented
Sep 5, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment