Thanks, it works.
Is there a way to check when the callback has finished processing files? For me, the loop ends quickly and the file menu drops out, but the callback continues to work and populates the menu, which automatically expands. I'd like to expand the menu when the callback is done, because if the menu doesn't fit the screen, then the file scrolling doesn't appear, and if I reopen the menu, it takes the number of items at once and adds scrolling. Also, if nothing is found, I would like to return the text "Nothing found", but I don't know when it will end and the algorithm considers that nothing was found instantly, although the search is not over yet.