Copy link to clipboard
Copied
Hi all,
I need to select content when palette window is exist. Acutally the pallete window is shown but it is not waiting. Before I select the content the script execution is finished. What to do.
Thanks in Advance,
Mahesh
This is my sample code.
main.jsx
........ number of lines
var flag = PaletteWork();
if(flag){
........ number of lines
}
else {
alert("not mapped");
........ number of lines
}
........ number of lines
MyUI.jsx
function PaletteWork() {
#targetengine "MyUI"
var wordParaListArr = []; // it is having list of styles
myMapDlg = new Window ('palette {text: "Mapping Palette", properties: {closeButton: false}}');
myMapDlg.grp1 = myMapDlg.add('group', [0,0,uiWidth,550], "");
myWordParaList = myMapDlg.grp1.add ("listbox", [0,25,280,290],wordParaListArr);
myMapDlg.grp1.RunBtn = myMapDlg.grp1.add('button', [275,5,375,35], 'Run');
myMapDlg.grp1.CloseBtn = myMapDlg.grp1.add('button', [395,5,495,35], 'Exit');
myWordParaList.onDoubleClick = function () {
//need to select the first occurance in the document based on the selected item
}
myMapDlg.grp1.RunBtn.onClick = function(){
alert("Mapping Completed");
myMapDlg.close(1);
}
myMapDlg.grp1.CloseBtn.onClick = function(){
myMapDlg.close(2);
}
var result = myMapDlg.show();
if(result == 1){
return true;
}
else if(result == 2){
return false;
}
}
Copy link to clipboard
Copied
Hi,
It would help if you explained what you are trying to achieve overall. Please include software and OS version.
Thanks
Copy link to clipboard
Copied
Hi Eric,
I am using Windows 10 OS. Actually I list the paragraph style in List box. If user double click any item I need to select and show the first occurance of the paragraph style.
The Palette window does not wait and it completes the execution. But the palette need to wait until I click the OK button. In mean time I will double click any of the item in list box and check the content that applied the selected paragraph style.
Regards,
Mahesh
Copy link to clipboard
Copied
Hi, I rewrote only one line.
Is this inconvenient?
myMapDlg = new Window ('dialog {text: "Mapping Palette"}');
Copy link to clipboard
Copied
Hi,
The 'dialog' is not suitable for my requirement.
Copy link to clipboard
Copied
Hi.
The "var result = myMapDlg.show ();" you used in your code is only valid in modal dialogs. If you like the palette, you need to take a different approach.
And your code completes the execution without waiting for the result of the palette operation. The palette stays visible, but the code is never paused.
It must be recognized that "continue processing in response to palette operation", but "start function processing in response to palette operation".
I completed it in the first line because there are some variables missing in the test run.
var flag, uiWidth = 500;
PaletteWork();
function doSomething(){
alert(flag);
}
function PaletteWork() {
//#targetengine "MyUI"
var wordParaListArr = []; // it is having list of styles
myMapDlg = new Window ('palette {text: "Mapping Palette", properties: {closeButton: false}}');
myMapDlg.grp1 = myMapDlg.add('group', [0,0,uiWidth,550], "");
myWordParaList = myMapDlg.grp1.add ("listbox", [0,25,280,290],wordParaListArr);
myMapDlg.grp1.RunBtn = myMapDlg.grp1.add('button', [275,5,375,35], 'Run');
myMapDlg.grp1.CloseBtn = myMapDlg.grp1.add('button', [395,5,495,35], 'Exit');
myWordParaList.onDoubleClick = function () {
//need to select the first occurance in the document based on the selected item
}
myMapDlg.onClose = doSomething;
myMapDlg.grp1.RunBtn.onClick = function(){
alert("Mapping Completed");
//myMapDlg.close(1);
flag = true;
myMapDlg.close();
}
myMapDlg.grp1.CloseBtn.onClick = function(){
//myMapDlg.close(2);
flag = false;
myMapDlg.close();
}
myMapDlg.show();
/*var result = myMapDlg.show();
if(result == 1){
return true;
}
else if(result == 2){
return false;
}*/
}
Regards.