R3vo – User talk

From Bohemia Interactive Community
Jump to navigation Jump to search
(display3denCopy wip page)
mNo edit summary
Line 14: Line 14:
However, this can be fixed like so:
However, this can be fixed like so:
<code>//Set variable used by diplay3denCopy and create the display
<code>//Set variable used by diplay3denCopy and create the display
uinamespace [[setVariable]] ["Display3DENCopy_data", [[[localize]] "STR_ENH_CONTEXTMENU_LOGOBJECTINFO", _text]];
uinamespace [[setVariable]] ["Display3DENCopy_data", [_header, _someLongText]];
_display [[a = b|=]] [[findDisplay]] IDD_3DEN [[createDisplay]] "Display3denCopy";
[[private]] _display [[a = b|=]] [[findDisplay]] IDD_3DEN [[createDisplay]] "Display3denCopy";


//Get the relevant controls
//Get the relevant controls
_ctrlGroup [[a = b|=]] _display [[displayCtrl]] 201;
[[private]] _ctrlGroup [[a = b|=]] _display [[displayCtrl]] 201;
_ctrlEdit [[a = b|=]] _display [[displayCtrl]] 202;
[[private]] _ctrlEdit [[a = b|=]] _display [[displayCtrl]] 202;
_ctrlEditFake [[a = b|=]] _display [[displayCtrl]] 203;
[[private]] _ctrlEditFake [[a = b|=]] _display [[displayCtrl]] 203;


//Adjust the height of the edit control properly
//Adjust the height of the edit control properly
_ctrlEdit [[ctrlSetPositionH]] ([[ctrlTextHeight]] _ctrlEdit [[max]] ([[ctrlPosition]] _ctrlGroup [[a hash b|#]] 3));
_ctrlEdit [[ctrlSetPositionH]] ([[ctrlTextHeight]] _ctrlEdit [[max]] ([[ctrlPosition]] _ctrlGroup [[a hash b|#]] 3));
_ctrlEditFake [[ctrlSetPositionH]] ([[ctrlTextHeight]] _ctrlEditFake [[max]] ([[ctrlPosition]] _ctrlGroup [[a hash b|#]] 3));
_ctrlEditFake [[ctrlSetPositionH]] ([[ctrlTextHeight]] _ctrlEditFake [[max]] ([[ctrlPosition]] _ctrlGroup [[a hash b|#]] 3));
_ctrlEdit ctrlcommit 0;
_ctrlEdit [[ctrlCommit]] 0;
_ctrlEditFake ctrlcommit 0;</code>
_ctrlEditFake [[ctrlCommit]] 0;</code>
   
   
[[Category:GUI Topics]]
[[Category:GUI Topics]]
[[Category: Eden Editor: Modding]]
[[Category: Eden Editor: Modding]]

Revision as of 17:50, 7 March 2021

display3denCopy with some example text

In Eden Editor, display3denCopy can be accessed to offer the user a way to inspect and copy long texts.

Open the Display

The display can be opened in Eden Editor by executing findDisplay 313 createDisplay "Display3denCopy";. While the display is mainly meant to be used inside the Editor it can also be used outside of it. To do so, just replace 313 with the IDD of your parent display.

Adding Custom Text

In order to display some text inside the edit box, one has to define the data. This is done via an uiNamespace variable like so:

uiNamespace setVariable ["Display3DENCopy_data", ["Text displayed as header", "Text the user can copy and inspect"]];

Adjusting the Control Height

Unfortunately, the display, or rather the code is bugged. You will noticed that for longer texts it will not properly adjust the control's height and therefore scrolling vertically will not work properly (Feedback Tracker Ticket).

However, this can be fixed like so: //Set variable used by diplay3denCopy and create the display uinamespace setVariable ["Display3DENCopy_data", [_header, _someLongText]]; private _display = findDisplay IDD_3DEN createDisplay "Display3denCopy";

//Get the relevant controls private _ctrlGroup = _display displayCtrl 201; private _ctrlEdit = _display displayCtrl 202; private _ctrlEditFake = _display displayCtrl 203;

//Adjust the height of the edit control properly _ctrlEdit ctrlSetPositionH (ctrlTextHeight _ctrlEdit max (ctrlPosition _ctrlGroup # 3)); _ctrlEditFake ctrlSetPositionH (ctrlTextHeight _ctrlEditFake max (ctrlPosition _ctrlGroup # 3)); _ctrlEdit ctrlCommit 0; _ctrlEditFake ctrlCommit 0;