String combo
This commit is contained in:
@ -302,6 +302,59 @@ function confirm2(title,smallText,fullText,okFunc,cancelFunc)
|
||||
return win;
|
||||
}
|
||||
|
||||
//С поле ввода
|
||||
function prompt2(title,smallText,fieldText,defaultText,okFunc,cancelFunc){
|
||||
let win=new TWin();
|
||||
win.BuildGUI(10,10);
|
||||
win.setCaption(document.createTextNode(title));
|
||||
let html='\n\
|
||||
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">\n\
|
||||
<tr style="width: 100%;">\n\
|
||||
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">'+smallText+'</td>\n\
|
||||
</tr>\n\
|
||||
<tr style="width: 100%;">\n\
|
||||
<td colspan="3" style="width: 100%;">'+fieldText+'</td>\n\
|
||||
</tr>\n\
|
||||
<tr style="width: 100%;">\n\
|
||||
<td colspan="3" style="width: 100%;"><textarea rows="5" style="width: 100%;" id="text_'+win.uid+'">'+defaultText+'</textarea></td>\n\
|
||||
</tr>\n\
|
||||
<tr style="height: 10px;">\n\
|
||||
<td style="width: 100%;"> </td>\n\
|
||||
<td><button class="button-secondary" id="'+win.uid+'_ok" style="width: 80px;margin:1px;">'+trt('Ok')+'</button></td>\n\
|
||||
<td><button class="button-secondary" id="'+win.uid+'_cancel" style="width: 80px;margin:1px;">'+trt('Cancel')+'</button></td>\n\
|
||||
</tr>\n\
|
||||
</table>';
|
||||
|
||||
win.setContent(html);
|
||||
|
||||
let btnO=document.getElementById(win.uid+'_ok');
|
||||
btnO.focus();
|
||||
if(btnO!=null){
|
||||
btnO.onclick=function(win){
|
||||
return function(){
|
||||
let text=document.getElementById('text_'+win.uid).value;
|
||||
win.Close();
|
||||
if(okFunc!=null) okFunc(text);
|
||||
};
|
||||
}(win,okFunc);
|
||||
}
|
||||
let btnC=document.getElementById(win.uid+'_cancel');
|
||||
if(btnC!=null) {
|
||||
btnC.onclick = function (win) {
|
||||
return function () {
|
||||
win.Close();
|
||||
if(cancelFunc!=null) cancelFunc();
|
||||
};
|
||||
}(win,cancelFunc);
|
||||
}
|
||||
|
||||
win.setSize("350px","200px");
|
||||
win.setCenter();
|
||||
win.shadow=true;
|
||||
win.hide(false);
|
||||
return win;
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавить событие к объекту
|
||||
* @param {object} obj Объект
|
||||
|
||||
Reference in New Issue
Block a user