Is it possible to determine, from one widget, whether another widget is active?
For example, in my new widget's startup function, can I tell whether the Scalebar widget is active?
Inactive:
Active:
Solved! Go to Solution.
Stephen,
You check for the "visible": false (inactive) property when looping through the appConfig.
var isActive = false;
array.some(this.appConfig.widgetOnScreen.widgets, function(wc){
if(wc.name === 'Scalebar'){
if(wc.visible){
isActive = true;
}
return true;
}
});
Stephen,
You check for the "visible": false (inactive) property when looping through the appConfig.
var isActive = false;
array.some(this.appConfig.widgetOnScreen.widgets, function(wc){
if(wc.name === 'Scalebar'){
if(wc.visible){
isActive = true;
}
return true;
}
});
Robert I am trying to use this script to check if a widget is open and it is then to close it. But I run into problems. The error is:
Uncaught TypeError: Cannot read property 'style' of null
I don't know why I get this since I trying to close the widget only if it is open. AM I missing something?
Also, the script check if it is visible. Is that means just visible on the screen or open?
Thank you.
var isActive = false;
array.some(this.appConfig.widgetOnScreen.widgets, function(wc){
if(wc.name === 'BufferSelection'){
if(wc.visible){
isActive = true;
WidgetManager.getInstance().closeWidget([0])
}
return true;
}
});
Lefteris,
The issue I see in your code is this:
WidgetManager.getInstance().closeWidget([0])
It should be:
WidgetManager.getInstance().closeWidget(wc.id);
Thank you. Sometimes the answer is staring at you...
I got a bizarre behavior. Instead of closing the widget, it empties the content of all UI components!! ???