2024-07-27 05:46:16 +02:00
|
|
|
function dialogCall(_dia, _x = noone, _y = noone, param = {}, create = false) {
|
2022-11-01 03:06:03 +01:00
|
|
|
if(_x == noone) _x = WIN_SW / 2;
|
|
|
|
if(_y == noone) _y = WIN_SH / 2;
|
|
|
|
|
2024-08-12 13:42:05 +02:00
|
|
|
var dia = (!create && instance_exists(_dia))? instance_find(_dia, 0) : instance_create_depth(_x, _y, 0, _dia, param);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
dia.x = _x;
|
|
|
|
dia.y = _y;
|
2023-01-25 06:49:00 +01:00
|
|
|
dia.xstart = _x;
|
|
|
|
dia.ystart = _y;
|
|
|
|
dia.resetPosition();
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-09-21 06:09:40 +02:00
|
|
|
var args = variable_struct_get_names(param);
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(args); i < n; i++ )
|
2022-09-21 06:09:40 +02:00
|
|
|
variable_instance_set(dia, args[i], variable_struct_get(param, args[i]));
|
2023-03-12 02:28:21 +01:00
|
|
|
|
|
|
|
setFocus(dia.id, "Dialog");
|
|
|
|
return dia;
|
2024-07-27 05:46:16 +02:00
|
|
|
}
|
2023-03-12 02:28:21 +01:00
|
|
|
|
2024-07-27 05:46:16 +02:00
|
|
|
function dialogPanelCall(_panel, _x = noone, _y = noone, params = {}) {
|
2023-03-12 02:28:21 +01:00
|
|
|
if(_x == noone) _x = WIN_SW / 2;
|
|
|
|
if(_y == noone) _y = WIN_SH / 2;
|
|
|
|
|
|
|
|
var dia = instance_create_depth(_x, _y, 0, o_dialog_panel);
|
2023-08-29 14:33:44 +02:00
|
|
|
variable_instance_set_struct(dia, params);
|
2023-03-12 02:28:21 +01:00
|
|
|
dia.setContent(_panel);
|
|
|
|
|
|
|
|
dia.x = _x;
|
|
|
|
dia.y = _y;
|
|
|
|
dia.xstart = _x;
|
|
|
|
dia.ystart = _y;
|
2024-07-27 05:46:16 +02:00
|
|
|
dia.anchor = _panel.anchor;
|
2023-03-12 02:28:21 +01:00
|
|
|
dia.resetPosition();
|
2022-09-21 06:09:40 +02:00
|
|
|
|
2024-07-02 10:51:52 +02:00
|
|
|
if(struct_try_get(params, "focus", true))
|
|
|
|
setFocus(dia.id, "Dialog");
|
2022-12-10 05:06:01 +01:00
|
|
|
return dia;
|
2024-07-27 05:46:16 +02:00
|
|
|
}
|
2024-01-28 09:53:41 +01:00
|
|
|
|
2024-07-27 05:46:16 +02:00
|
|
|
function colorSelectorCall(defColor, onApply) {
|
2024-01-28 09:53:41 +01:00
|
|
|
var dialog = dialogCall(o_dialog_color_selector);
|
|
|
|
|
|
|
|
dialog.setDefault(defColor);
|
|
|
|
dialog.selector.onApply = onApply;
|
|
|
|
dialog.onApply = onApply;
|
|
|
|
|
|
|
|
return dialog;
|
2024-07-27 05:46:16 +02:00
|
|
|
}
|