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: 144
Joined: 27 May 2014 05:24

Pop up menus with columns instead of scroll

Post by jaywalker32 » 14 Mar 2019 15:27

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: 8304
Joined: 06 Feb 2011 00:33

Re: Pop up menus with columns instead of scroll

Post by highend » 14 Mar 2019 15:48

XY inbuilt ones? No.
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

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

Re: Pop up menus with columns instead of scroll

Post by jaywalker32 » 15 Mar 2019 05:25

What about custom menus from popupmenu()?

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

Re: Pop up menus with columns instead of scroll

Post by highend » 15 Mar 2019 07:22

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 or highend (at) web (dot) de

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

Re: Pop up menus with columns instead of scroll

Post by jaywalker32 » 15 Mar 2019 11:31

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: 8304
Joined: 06 Feb 2011 00:33

Re: Pop up menus with columns instead of scroll

Post by highend » 15 Mar 2019 12:31

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 or highend (at) web (dot) de

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

Re: Pop up menus with columns instead of scroll

Post by jaywalker32 » 15 Mar 2019 13:39

Thanks. I can see how it would work.

Post Reply