Can't scroll with mouse wheel in an intellij popup

Hi,

I've created a popup with a scrollpane inside it. But for some reason I'm unable to scroll it when running it inside intellij.

The scroll works as expected when running standalone. This is the code of popup: https://github.com/fctorial/world_clock_intellij/blob/be272dd55e54abbe23b071cbb82eda9e2717c254/src/main/java/ZoneChooser.java

To run it standalone, clone the repo, checkout the above revision, apply this patch run the main method of `ZoneChooser`:

https://gist.github.com/fctorial/111ccc1795a791e747c2a55bcfabb794

You'll have to type something inside the textfield in the middle for the search results to appear.

10 comments
Comment actions Permalink

It is impossible to diagnose without knowing what your exact target IDE platform version is. As you're using `localPath "/mnt/DATA/software/idea-IU"`.

Please provide exact build number, Java Runtime version and any differences in VM parameters and installed plugins.

0
Comment actions Permalink

I tried it on `idea-IC-201.6668.121` and `idea-IU-202.6250.13`.

0
Comment actions Permalink

I attached mousewheel listeners to every component from the `JBList` to the root and it turns out that none of the components recieve any mousewheel events when I scroll over an intellij popup.

0
Comment actions Permalink

Are you using exact same JBR (java environment) in both cases?

0
Comment actions Permalink

Please provide a clean branch to checkout on the repo that has all required patches applied, I can't compile using your instructions.

Also please upgrade to Gradle >6.1 which has known problems importing Plugin projects with OOM.

0
Comment actions Permalink

I've uploaded the demo here[1] with gradle 6.4. `ZoneChooserStandalone` has a main method that'll run the standalone popup demo, and scrolling works in it as expected.

 

[1] https://github.com/fctorial/world_clock_intellij/tree/scroll_bug_demo

0
Comment actions Permalink

I reproduced the scrolling problem running in 2020.1.

Unfortunately, the code has a number of problems that should be solved first.

TimeWidgetFactory#activeWidgets looks dubious, same for TimeWidget#task

Your plugin.xml defines <idea-version since-build="193" /> but com.intellij.openapi.wm.StatusBarWidgetFactory is available only in 2020.1. There might be more problems and errors that might lead to non-functioning at runtime.

I'd highly recommend to use default IJ Platform UI widgets to create and handle the UI https://jetbrains.org/intellij/sdk/docs/user_interface_components/popups.html#popups.

See also com.intellij.openapi.vfs.encoding.ChangeFileEncodingAction#createPopup which has code for "Change Encoding" status bar widget which seems very similar to your needs.

0
Comment actions Permalink

> Your plugin.xml defines <idea-version since-build="193" />

Yes, this issue came up when publishing plugin. I changed it in plugin page but not in the repo.

> See also com.intellij.openapi.vfs.encoding.ChangeFileEncodingAction#createPopup

At first I implemented it with `JBPopupFactory` but then the popup won't receive any input at all. I'll try reverting to that and share the code.

Also the behavior is same whether I use `JLabel` etc or `JBLabel` etc classes in `ZoneChooser`.

> TimeWidgetFactory#activeWidgets looks dubious, same for TimeWidget#task

Could you explain the reason for that? I try to release them in `dispose` and `disposeWidget` methods of owning classes.

0
Comment actions Permalink

Regarding "dubious", this code seems unnecessary (and dangerous). Please look at other existing StatusBarWidget implementations as reference.

0

Please sign in to leave a comment.