Kotlin DSL UI: scroll pane takes wrong height of MemberSelectionTable
Answered
I'm trying to add members selection to my form, let's take simplest one:
val table = MemberSelectionTable(members, null)
panel {
row {
scrollPane(table)
}
}
Unfortunately, scroll pane height becomes table height minus header and one of member is not shown.
What can I do here?
Please sign in to leave a comment.
Sorry this got lost. What does MemberSelectionTable extend from?
It's com.intellij.refactoring.ui.MemberSelectionTable and it extends AbstractMemberSelectionTable<PsiMember, MemberInfo>
Sorry for delay.
I failed to reproduce this behavior in 2020.2.4 with this simple test action/dialog on macOS. Could you please specify your IDE version and OS? Does this test code work on your system? Thanks.
In your case members count is high enough to add scroll anyway. If you limit it, for instance, to 4:
you will see that only 3 members shown.
if I expand it by dragging with mouse, all 4 members shown and scroll disappears:
PS 2020.2.4 Ultimate, Windows 10 Pro
AbstractMemberSelectionTable constructor specifies "default' size/number of visible rows. You can override this in your code explicitly:
Thanks!
setVisibleRowCount doesn't work as expected, looks like header height still not used in calculation. I will use workaround with preferredScrollableViewportSize and calculate height with header manually.