# Enabled function issue

**URL:** https://discourse.paraview.org/t/enabled-function-issue/9843
**Category:** Web Support
**Tags:** vtkjs
**Created:** [June 18, 2022, 6:27am UTC](https://discourse.paraview.org/t/enabled-function-issue/9843 "2022-06-18T06:27:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mayukhdeep\_Mathur](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/65b543/32.png) [@Mayukhdeep\_Mathur](https://discourse.paraview.org/u/Mayukhdeep_Mathur)
#### Post date: [June 18, 2022, 6:27am UTC](https://discourse.paraview.org/t/enabled-function-issue/9843/1 "2022-06-18T06:27:00Z")

</div>

I tried to console both scripts, but only the **(left) CropTool** file shows the enabled function console output, but the **(Rght) ResliceCursor** file does not. Why is this happening?

 ![Screenshot 2022-06-18 114842](https://discourse.paraview.org/uploads/default/original/2X/a/ad4aba6f184caaaab87bd2b6660e0a59326b392d.png)

 ![Screenshot 2022-06-18 115418](https://discourse.paraview.org/uploads/default/original/2X/e/ef8637d698e323ea0a0d4fa34177b7a192082ab7.png)  
This is CropTool Console Output 👆  
However, the console is no longer visible in Reslice

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 20, 2022, 1:21pm UTC](https://discourse.paraview.org/t/enabled-function-issue/9843/3 "2022-06-20T13:21:27Z")

</div>

Are you looking for: [https://discourse.vtk.org/c/web/9](https://discourse.vtk.org/c/web/9) ?

---

<div class="post-metadata">

### Author: ![Forrest\_Li](https://discourse.paraview.org/user_avatar/discourse.paraview.org/forrest_li/32/1935_2.png) [@Forrest\_Li](https://discourse.paraview.org/u/Forrest_Li)
#### Post date: [June 20, 2022, 8:07pm UTC](https://discourse.paraview.org/t/enabled-function-issue/9843/5 "2022-06-20T20:07:25Z")

</div>

> <https://github.com/Kitware/glance/issues/444#issuecomment-1160801681>
>
> I implemented the \*\*ResliceCursorWidget\*\* script and the html file inside \*\*glan…ce\*\*, but I can’t figure out what the problem is with the code. I checked the console (browser) and the terminal, and both show no errors.
> I believe the issue is with the ResliceWidget functions I’m using; they may be incorrect; I’ve checked the functions on vtk.js github, the Reslice class reference, and the documentation.
> Could you please check the code and let me know what is wrong with it?
> 
> Here’s the code for the html and script files.
> \*\*Template.html\*\*
> 
> \`\`\`
> \<div\>
> \<v-container :class="$style.container" class="black"\>
> \<v-layout wrap align-center\>
> \<v-flex xs12\>
> \<source-select
> label="Target volume"
> :filterFunc="resliceFilterImages"
> bindToActiveSource
> hideIfOneDataset
> @input="setTargetVolume"
> /\>
> \</v-flex\>
> \</v-layout\>
> \</v-container\>
> \<v-container :class="$style.container" class="black"\>
> \<v-layout wrap align-center\>
> \<template v-if="enabled"\>
> \<v-btn text @click="disable"\>
> \<v-icon left\>mdi-cursor\</v-icon\>
> Hide
> \</v-btn\>
> \</template\>
> \<template v-else\>
> \<v-btn text @click="enable" :disabled="!canReslice" class="white--text"\>
> \<v-icon left color="white"\>mdi-plus\</v-icon\>
> Reslice
> \</v-btn\>
> \</template\>
> \<v-spacer /\>
> \<v-btn @click="reset" text class="white--text"\>
> \<v-icon left color="white"\>mdi-replay\</v-icon\>
> Reset
> \</v-btn\>
> \</v-layout\>
> \</v-container\>
> \</div\>
> \`\`\`
> \*\*Script.js\*\*
> \`\`\`
> watch: {
> enabled(enabled) {
> console.log("Reslice Emabled working")
> if (enabled) {
>                 
> const resliceFilter = this.getCropFilter(this.targetVolume);
> 
> let resliceProxy = this.resliceProxy;
> if (!resliceProxy) {
> resliceProxy = this.$proxyManager
> .getProxyInGroup('Widgets')
> .find((w) =\> w.getProxyName() === 'ResliceCursor');
> if (!resliceProxy) {
> resliceProxy = this.$proxyManager.createProxy('Widgets', 'ResliceCursor');
> }
> this.widgetId = resliceProxy.getProxyId();
> }
> 
> const widget = resliceProxy.getWidget();
> const widgetState = resliceProxy.getWidgetState();
> 
> // widget.updateCameraPoints(false);
> 
> const imageData = this.targetVolume.getDataset();
> widget.setImage(imageData);
> 
> widget.placeWidget(imageData.getBounds());
> 
> 
> if(resliceFilter.isResetAvailable()) {
> const state = widgetState.updateReslice();
> state.setPlanes(resliceFilter.updateReslice());
> }
> 
> const resliceState = widgetState.updateReslice();
> this.stateSub.sub(
> resliceState.onModified(() =\> {
> const reslicer = resliceState.getPlanes();
> resliceFilter.updateReslice(reslicer);
> this.canReset = resliceFilter.isResetAvailable();
> this.storeResliceState(this.targetVolumeId, reslicer);
> })
> );
> 
> resliceProxy.addToViews();
> } else {
> this.resliceProxy.removeFromViews();
> this.$proxyManager.deleteProxy(this.resliceProxy);
> this.widgetId = -1;
> this.stateSub.unsub();
> }
> },
> \`\`\`

Please do not spread out the same question across multiple threads. I would recommend sticking to the Glance issue tracker, as that will make it easier for us to answer.
