Page 1 of 1

Trouble implementing WidgetRules?

Posted: Tue Jun 15, 2021 4:24 pm
by dmavro
Im having an issue implementing setWidgetRules for my addons. Im trying to turn off the widget display for the plots in my addon that way i dont have to manually turn them off when i enable my addons for the 1st time. I tried to use code that i found in this forum post.

I tried to implement it in my initialize code like this....  

Indicator Indicator = api.registerIndicator("fstPctLvl ", GraphType.PRIMARY, Double.NaN, true, false);

and i also tried it like this....

private IndicatorModifiable fstPctLvl ;
fstPctLvl = api.registerIndicatorModifiable ("fstPctLvl ", GraphType.PRIMARY, Double.NaN, true, false);

but i cant seem to get it to work. I keep getting this error ...

The method registerIndicator(String, Layer1ApiUserMessageModifyIndicator.GraphType, double) in the type Api is not applicable for the arguments (String, Layer1ApiUserMessageModifyIndicator.GraphType, double, boolean, boolean)


Any help would be appreciated.

Thanks,
Dean 

Re: Trouble implementing WidgetRules?

Posted: Wed Jun 16, 2021 7:42 am
by Andry API support
Hi Dean,
I need to see your build.gradle file. It is in your project folder.

Re: Trouble implementing WidgetRules?

Posted: Fri Jun 18, 2021 1:13 am
by dmavro
Andrey,

Here are the contents of the file....

Code: Select all

 
apply plugin: 'java'
apply plugin: 'eclipse'

repositories {
    mavenCentral()
    maven {
        url "https://maven.bookmap.com/maven2/releases/"
    }
}

eclipse.classpath.downloadJavadoc = true

dependencies {
    compileOnly group: 'com.bookmap.api', name: 'api-core', version: '7.1.0.66';
    compileOnly group: 'com.bookmap.api', name: 'api-simplified', version: '7.1.0.66';
 
    //compile group: 'com.opencsv', name: 'opencsv', version: '5.3'  
    implementation group: 'com.opencsv', name: 'opencsv', version: '5.3'
}

Thanks,
Dean

Re: Trouble implementing WidgetRules?

Posted: Fri Jun 18, 2021 8:03 am
by Andry API support
Hi Dean,
1) what Bookmap version are you running?
2) do you have this error in runtime (when using your strategy) or in compile time (in your IDE)?

Re: Trouble implementing WidgetRules?

Posted: Fri Jun 18, 2021 7:17 pm
by dmavro
AndreyR wrote:
Fri Jun 18, 2021 8:03 am
Hi Dean,
1) what Bookmap version are you running?
2) do you have this error in runtime (when using your strategy) or in compile time (in your IDE)?

Hi Andrey,

Im running 7.2.0 build 16. I get the error in Eclipse as soon as i write the code.

Thanks,
Dean

Re: Trouble implementing WidgetRules?

Posted: Mon Jun 21, 2021 10:07 am
by Andry API support
please change the api- libs in your build.gradle to 7.2.0.16 and rebuild your project

Code: Select all

dependencies {
    compileOnly group: 'com.bookmap.api', name: 'api-core', version: '7.2.0.16';
    compileOnly group: 'com.bookmap.api', name: 'api-simplified', version: '7.2.0.16';

Re: Trouble implementing WidgetRules?

Posted: Mon Jun 21, 2021 3:08 pm
by dmavro
Andrey,

That fixed issue. Thank you. I had this issue once before with something else which forced me to change to the version i had been using.

Question....
In the future should i just always make sure my api-libs for any addons in development match my current Bookmap version? Or do the API versions not change with every new build of Bookmap?


Thanks,
Dean

Re: Trouble implementing WidgetRules?

Posted: Tue Jun 22, 2021 10:45 am
by Andry API support
Sometimes they do. It is better to keep the same version of Bookmap and api libs.

Re: Trouble implementing WidgetRules?

Posted: Tue Jun 22, 2021 2:20 pm
by Svyatoslav
Normally, we only add features and try to avoid breaking compatibility. So you typically want to develop for the lowest supported version of API (e.g if you intend your addon to run starting with 7.1.0 build 14, then you want api libs of version 7.1.0.14). That helps you avoid a situation where you accidentally start relying on newer functionality, making it impossible for users with older bookmap builds to run your addon.