B4J Question [B4XView] Slider Cast Exception

rwblinn

Well-Known Member
Licensed User
Longtime User
In a B4J (v9.10, JDK 11) UI Project, created a Slider as B4XView (via designer Add View > Slider).

When accessing the slider property progress a cast exception occurs:

B4X:
Log($"Slider Value: ${Slider1.Progress}"$)

C++:
java.lang.ClassCastException: class javafx.scene.control.Slider cannot be cast to class javafx.scene.control.ProgressIndicator (javafx.scene.control.Slider and javafx.scene.control.ProgressIndicator are in module javafx.controls of loader 'app'), StackTrace: java.lang.ClassCastException: class javafx.scene.control.Slider cannot be cast to class javafx.scene.control.ProgressIndicator (javafx.scene.control.Slider and javafx.scene.control.ProgressIndicator are in module javafx.controls of loader 'app')

Q: How to get the slider progress (or value)?
 

Attachments

  • TestSliderBX4.zip
    2.2 KB · Views: 148

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can see the supported types in the inline documentation:

1633953168264.png


You will need to cast it:
B4X:
Dim value As Double = Slider1.As(Slider).Value
 
Upvote 0
Top