Disable User Interaction

You must Login before you can answer or comment on any questions.

I have a situation where I need to disable user interaction with user inputs , like i have filled username now i need to authenticate it with server. So the time while xhr is authenticating user cannot interact and navigate with the current view and its elements/objects Like other input fields ..

4 Answers

Accepted Answer

@gaurav you can try adding a layout over the top of everthing with

var overlay_view = Ti.Ui.createView({
    height:'100%',
    width:'100%',
    top:0,
    left:0
})
win.add(overlay_view);
Don't assign any color to it or if u want you can add some color and opacity of .8 or .7

This will make it on top of everything and user will not be ale to interact with anything !!

— answered 10 months ago by Sahil Grover
answer permalink
1 Comment
  • This is really bad if someone is trying to help someone else and people mark it down negative without any reason.

    At least comment over here so that I can know what is wrong with the answer I have given here!!

    — commented 10 months ago by Sahil Grover

Hi, Good option is to add activity indicator to window , when authenticate it with server , activity indicator block the Ui , means user can not interact with the inputs.

— answered 10 months ago by Moiz Chhatriwala
answer permalink
6 Comments
  • try this

    ActInd = Titanium.UI.createActivityIndicator({
    height:50,
    message:"Requesting..",
    width:10
    });
     
     ActInd.show();
     
    var xhr = Titanium.Network.createHTTPClient();
    xhr.ondatastream = function(e) { Titanium.UI.currentWindow.add(ActInd ); };
    xhr.onload = function() {
     // Data comes in this block so after finishing you may hid indicator
            ActInd.hide();
    }
     
    xhr.onerror = function(e) {
    Ti.API.info("error = " + e.error);
    ActInd.hide();
    var alertDialog = Titanium.UI.createAlertDialog({
        message: 'Sorry No Network !',
        buttonNames: ['OK','']
    });
     
    alertDialog.show();
    }; xhr.open('POST','https://www.your string);
    xhr.setTimeout(20000);
    xhr.send(SendRequest);

    — commented 10 months ago by Moiz Chhatriwala

  • Refer this link as reference . hope this help you.

    — commented 10 months ago by Moiz Chhatriwala

  • thanks for your response.. I am using activity ActivityIndicator.. but it donot disable the user interaction I think .. User can still interact with objects. :(

    — commented 10 months ago by Gaurav Sood

  • Show 3 more comments

Add a layer of view with top: 0, left: 0, right: 0, bottom: 0, backgroundColor: "transparent". Then add an activity indicator on it.. hide/show the view based on your requirement.

Hi Gaurav Sood,

First option is to use Activity Indicator but if you want to use this then it's ok but If you are using TabGroup then you can set tabGroup.touchEnabled = false after you get response then reset it tabGroup.touchEnabled = true.

Your Answer

Think you can help? Login to answer this question!