Pop up menus with columns instead of scroll

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
jaywalker32
Posts: 205
Joined: 27 May 2014 05:24

Pop up menus with columns instead of scroll

Post by jaywalker32 »

Is it possible to make long pop-up menus show in two or more columns instead of having to scroll? A setting or a tweak? :?:

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Pop up menus with columns instead of scroll

Post by highend »

XY inbuilt ones? No.
One of my scripts helped you out? Please donate via Paypal

jaywalker32
Posts: 205
Joined: 27 May 2014 05:24

Re: Pop up menus with columns instead of scroll

Post by jaywalker32 »

What about custom menus from popupmenu()?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Pop up menus with columns instead of scroll

Post by highend »

You have control over their design so create columns if they would be too long on low screen sizes...
One of my scripts helped you out? Please donate via Paypal

jaywalker32
Posts: 205
Joined: 27 May 2014 05:24

Re: Pop up menus with columns instead of scroll

Post by jaywalker32 »

I can limit the number of items displayed using the [count] option but cannot find an option to split overlong menus into multiple columns.

eg.

Code: Select all

popupmenu(quicksearch("*.xys",,"|"), 4:=100);
Can you give me pointer on how I would go about splitting this into two columns instead of the default column with the scroll bars at the top and bottom?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Pop up menus with columns instead of scroll

Post by highend »

popupmenu doesn't have submenus...

Code: Select all

    $splitOn = 50;

    $results = quicksearch("*.xys");
    $cntResults = gettoken($results, "count", <crlf>);

    $splits = $cntResults % $splitOn;
    if ($splits) { $splits = regexreplace(($cntResults / $splitOn), "(\d+)(\.|,)\d*", "$1") + 1; }
    else { $splits = $cntResults / $splitOn; }

    $menu = "";
    while ($i++ < $splits) {
        if ($i * $splitOn > $cntResults) { $max = $cntResults; }
        else { $max = $i * $splitOn; }

        if ($i == 1) {
            $menu .= "$i - " . $max . <crlf>;
            $items = gettoken($results, $splitOn, <crlf>, , 1);
        } else {
            $menu .= ($i * $splitOn) - $splitOn + 1 . " - " . $max . <crlf>;
            $getThis = gettoken($results, $max, <crlf>, , 1);
            $items = gettoken($getThis, ($i * $splitOn) - $splitOn + 1, <crlf>, , 2);
        }
        $menu .= regexreplace($items, "^(.)", "<space 4>$1") . <crlf>;
    }
    $selection = popupnested($menu);
One of my scripts helped you out? Please donate via Paypal

jaywalker32
Posts: 205
Joined: 27 May 2014 05:24

Re: Pop up menus with columns instead of scroll

Post by jaywalker32 »

Thanks. I can see how it would work.

Post Reply