HazJ 1288 Posted February 15, 2019 Hi. I have become a little stuck and need someone to point me in the right direction. How do I get the control height to automatically adjust string length. I am thinking ctrlTextHeight command but not sure what to do with it. It sounds simple, get the ctrlTextWidth but I still need to apply the default h value? Surely it will just return that instead of string length? I can use count to get the string length but example output from one is like 1051. I am using ControlsGroup container. Any ideas? { _message = _display ctrlCreate ["RscText", (100 + _forEachIndex), _logsContainer]; _message ctrlSetText _x; _message ctrlSetPosition [ 0, (0.04 * _forEachIndex), ???, ??? ]; _message ctrlCommit 0; } forEach messagesArr; UPDATE: Attempt 2. Getting warmer or colder? Hmm. 😀 { _message = _display ctrlCreate ["RscText", (100 + _forEachIndex), _logsContainer]; _message ctrlSetText _x; _message ctrlSetPosition [ 0, (0.04 * _forEachIndex), 1, 10 ]; _height = ctrlTextHeight _message; _message ctrlSetPosition [ 0, (0.04 * _forEachIndex), 1, _height ]; _message ctrlCommit 0; } forEach messagesArr; Share this post Link to post Share on other sites
HazJ 1288 Posted February 17, 2019 Bump. Still stuck. Any ideas? Maybe @Larrow 😃 Share this post Link to post Share on other sites
pierremgi 4737 Posted February 17, 2019 Perhaps with Bis_fnc_ctrlFitToTextHeight ? Not digged in. Share this post Link to post Share on other sites
Mr H. 400 Posted February 17, 2019 I'm using the following, works like a charm: /* Function name: MRH_fnc_MilsimTools_Core_SetCtrlSize Author: Mr H. Description: Resizes given control's height according to the size of the text it contains Return value: none Public: no Parameters: 0 - <NUMBER> displayIDC 1- <NUMBER> controlIDC Example(s): [260518,1105] call MRH_fnc_MilsimTools_Core_SetCtrlSize; */ params ["_displayIDC","_ctrlIDC"]; _control =((findDisplay _displayIDC) displayCtrl _ctrlIDC); _myControlPos = ctrlPosition _control; _ctrlh = ctrlTextHeight _control; _xpos = _myControlPos select 0; _ypos = _myControlPos select 1; _width = _myControlPos select 2; _control ctrlSetPosition [_xpos,_ypos ,_width ,_ctrlh]; _control ctrlCommit 0; 2 Share this post Link to post Share on other sites
killzone_kid 1326 Posted February 17, 2019 This is exactly what https://community.bistudio.com/wiki/BIS_fnc_ctrlTextHeight does. https://community.bistudio.com/wiki/BIS_fnc_ctrlFitToTextHeight does this as well 2 1 Share this post Link to post Share on other sites