fn_toggleIfPosition.sqf 775 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. Name: cTab_fnc_toggleIfPosition
  3. Author(s):
  4. Gundy
  5. Description:
  6. Toggle position of interface (display only) from left to right or reset dialog to default position
  7. Parameters:
  8. NONE
  9. Returns:
  10. BOOLEAN - TRUE
  11. Example:
  12. [] call cTab_fnc_toggleIfPosition;
  13. */
  14. private ["_displayName"];
  15. // bail if there is no interface open
  16. if (isNil "cTabIfOpen") exitWith {false};
  17. _displayName = cTabIfOpen select 1;
  18. if ([_displayName] call cTab_fnc_isDialog) then {
  19. // reset position to default
  20. [_displayName,[["dlgIfPosition",[]]],true,true] call cTab_fnc_setSettings;
  21. } else {
  22. _dspIfPosition = [_displayName,"dspIfPosition"] call cTab_fnc_getSettings;
  23. // toggle position
  24. [_displayName,[["dspIfPosition",!_dspIfPosition]]] call cTab_fnc_setSettings;
  25. };
  26. true