{"name":"BIS_fnc_initListNBoxSorting","operator":null,"title":"BIS fnc initListNBoxSorting","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_initListNBoxSorting","revid":349789,"updated":"2023-11-20T22:10:14Z","groups":["GUI"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.56"}],"since":{"game":"arma3","name":"Arma 3","version":"1.56"},"arma3_since":"1.56","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Automatically creates buttons and sets them up so they can be used to sort a CT_LISTNBOX. The buttons will automatically be resized to fit the column width of **ctrlFilter**.\n\nBy default, the **ctrlContent** columns are sorted by lnbText (using lnbSort). If a specific column should be sorted by lnbValue (using lnbSortByValue) instead, then something needs to be set in the data of the corresponding **ctrlFilter** column (literally *something*, the condition in the source code is `(_ctrlFilter lnbData [0, _i]) != \"\"`).\n\nRegarding **ctrlFilter**:\n- The position and size of this control define where the buttons for sorting are created, thus it should be placed above **ctrlContent** and its columns should have the same size as the columns of **ctrlContent**.\n- The text set in the columns is displayed as text for the buttons (the buttons are actually transparent).\n- The control can also be part of a CT_CONTROLS_GROUP. If that is the case, the buttons will be created as children of that group.\n- To keep a uniform style between vanilla and custom controls it is recommended to create a background with CT_STATIC behind **ctrlFilter** with `colorBackground[] = { 0, 0, 0, 1 };`.\nSee CT_LISTNBOX#BIS_fnc_initListNBoxSorting Example for a full example including a config.","syntaxes":[{"syntax":"[ctrlFilter, ctrlContent, columnIndexes, idc] call BIS_fnc_initListNBoxSorting","since":null,"effect":null,"exec":null,"params":[{"name":"ctrlFilter","type":"Control","optional":false,"default":null,"description":"dummy CT_LISTNBOX control used for setting up the filter.","types":["Control"],"since":null,"text":"ctrlFilter: Control - dummy CT_LISTNBOX control used for setting up the filter."},{"name":"ctrlContent","type":"Control","optional":false,"default":null,"description":"the CT_LISTNBOX which actually contains the sortable content.","types":["Control"],"since":null,"text":"ctrlContent: Control - the CT_LISTNBOX which actually contains the sortable content."},{"name":"columnIndexes","type":"Array of Numbers","optional":true,"default":"[]","description":"these are the column indexes of *ctrlContent* which should be sortable. An empty array means all columns are sortable.","types":["Array","Number"],"since":null,"text":"columnIndexes: Array of Numbers - (Optional, default: []) these are the column indexes of *ctrlContent* which should be sortable. An empty array means all columns are sortable."},{"name":"idc","type":"Number","optional":true,"default":"200","description":"used to assign IDCs to the buttons created by this function. The first button has **idc**, the second button has **idc** + 1 and so on.","types":["Number"],"since":null,"text":"idc: Number - (Optional, default: 200) used to assign IDCs to the buttons created by this function. The first button has **idc**, the second button has **idc** + 1 and so on."}],"returns":{"type":"Boolean","types":["Boolean"],"description":"true on success, otherwise false","text":"Boolean - true on success, otherwise false"}}],"examples":[{"text":"```sqf\n[_lnbFilter, _lnbContent, [0,1,2,3]] call BIS_fnc_initListNBoxSorting;\n```","code":["[_lnbFilter, _lnbContent, [0,1,2,3]] call BIS_fnc_initListNBoxSorting;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_initSliderValue"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: GUI","Functions","Introduced with Arma 3 version 1.56"],"docblock":null,"filled_from_docblock":[]}