I finally got the SeekBar example sorted out, and tried to make a similar one for a scrollview, since all my ideas for new library involve this view.
Can someone make the seekbar example work for ScrollView ?
Then I'll need help in adding a Label to the panel and in getting the scroll event working inside the library as well as in the B4A application.
Thanks in advance...
Here is the seekbar code:
Can someone make the seekbar example work for ScrollView ?
Then I'll need help in adding a Label to the panel and in getting the scroll event working inside the library as well as in the B4A application.
Thanks in advance...
Here is the seekbar code:
B4X:
package derez.libs;
import android.widget.SeekBar;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ActivityObject;
import anywheresoftware.b4a.BA.DontInheritEvents;
import anywheresoftware.b4a.BA.Events;
import anywheresoftware.b4a.BA.Hide;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.objects.ViewWrapper;
@ActivityObject
@ShortName("SeekBar")
@Author("xxx")
@Version(1f)
@DontInheritEvents
@Events(values={"ValueChanged (Value As Int, UserChanged As Boolean)"})
public class SeekBarWrapper extends ViewWrapper<SeekBar>
{
@Override
@Hide
public void innerInitialize(final BA ba, final String eventName, boolean keepOldObject)
{
if (!keepOldObject)
setObject(new SeekBar(ba.context));
super.innerInitialize(ba, eventName, true);
if (ba.subExists(eventName + "_valuechanged"))
{
getObject().setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
{
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{
ba.raiseEvent(getObject(), eventName + "_valuechanged", progress, fromUser);
}
@Override
public void onStartTrackingTouch(SeekBar arg0)
{
}
@Override
public void onStopTrackingTouch(SeekBar arg0)
{
}
});
}
}
/**
* Gets or sets the maximum allowed value.
*/
public int getMax() {
return getObject().getMax();
}
public void setMax(int value) {
getObject().setMax(value);
}
/**
* Gets or sets the current value.
*/
public int getValue() {
return getObject().getProgress();
}
public void setValue(int value) {
getObject().setProgress(value);
}
}
Last edited: