DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


Sidebar

News

Version1.42 is out since December 2nd 2016


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

tips_tricks:seekbar_setontouchup

Seekbar SetOnTouchUp

(Sample Code posted by Steve Garman taken from the DroidScript Google Group)

Is something like that posible? There is no built-in way of doing this at present. But with this workaround you can simulate this.

//Called when application is started.
function OnStart()
{
    //Create a layout with objects vertically centered.
    lay = app.CreateLayout( "absolute", "" );    
 
    //Create a text label and add it to layout.
    skb = app.CreateSeekBar( 0.8 );
    skb.SetPosition(0.1, 0.4, 0.8, 0.1);
    img = app.CreateImage(null, 0.8, 0.1);
    setTimeout(imgSetup,0);
    lay.AddChild( skb );
    lay.AddChild(img);
 
    //Add layout to app.    
    app.AddLayout( lay );
}
function imgSetup()
{
    img.SetColor("#00000000");
    img.SetPosition(0.1, 0.4, 0.8, 0.1);
    img.SetOnTouch(imgOnTouch);
}
 
function imgOnTouch(ev)
{
    app.SimulateTouch(skb, ev.X, ev.Y, ev.action);
    if(ev.action == "Up") skbOnTouchUp(ev);
}
 
function skbOnTouchUp(ev)
{
    app.ShowPopup("Up\n"+skb.GetValue());
}
tips_tricks/seekbar_setontouchup.txt · Last modified: 2015/03/03 17:25 by octazid