{"name":"ctrlSetTextSelection","title":"ctrlSetTextSelection","type":"command","url":"https://community.bistudio.com/wiki/ctrlSetTextSelection","revid":309239,"updated":"2022-05-04T10:30:57Z","groups":["GUI Control"],"status":"ok","games":{"arma3":"2.00"},"since":"arma3 2.00","arma3_since":"2.00","description":"Selects `length` characters of edit control from the `start` position and places cursor at the end of selection.\n\n> [!NOTE]\n> To only move the cursor, set *length* to 0. To select text from right to left, use negative *length* (See ctrlTextSelection for more info)","syntaxes":[{"syntax":"control ctrlSetTextSelection [start, length]","params":[{"name":"control","type":"Control","type_expr":"Control"},{"name":"start","type":"Number","description":"selection start position","type_expr":"Number"},{"name":"length","type":"Number","description":"length of characters to select (0 to only move the cursor). Negative length will select text from right to left (see example 3)","type_expr":"Number"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"control"},"right":{"text":"[start, length]"}}],"examples":[{"code":["_control ctrlSetTextSelection [5, 10];"]},{"code":["disableSerialization;\nprivate _ctrl = findDisplay 46 createDisplay \"RscDisplayEmpty\" ctrlCreate [\"RscEditMulti\", -1];\n_ctrl ctrlSetPosition [0,0,0.5,0.3];\n_ctrl ctrlCommit 0;\n_ctrl ctrlSetText \"Hello World\";\n_ctrl ctrlSetTextSelection [6, 5]; // selects World\nctrlSetFocus _ctrl;"]},{"text":"Select text from right to left:\n\n```sqf\n_control ctrlSetTextSelection [5, -4];\n```","code":["_control ctrlSetTextSelection [5, -4];"]}],"see_also":["ctrlTextSelection","ctrlSetText"]}