onClick + dialogue

Hi, in my application at first I show user application privileges so that he can have whatever he wants.

but I want to show a dialog box which will inform the user now that he can change the permissions of the app. the problem is that when I try to display the dialog box, the application crash. Looks like, check privileges do not like something before.

I was wondering - can I display a dialog box and an onClick method - when the user clicks "ok", then permissions are shown?

but I can't find anything like onClick...

in my application, it looks like more or less this:

   _ui = Ui.getUiEngine();
        _screen = new Dialog(Dialog.OK, "information", Dialog.OK,
                Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),
                Manager.VERTICAL_SCROLL);

        _ui.queueStatus(_screen, 1, true);

getPrivileges();

I ' found a solution. That's what I was looking for:

   public void test(){

        UiApplication.getUiApplication().invokeLater(new Runnable(){
            public void run(){

                Object[] _choice = new Object[]{"ok"};
                int _result = Dialog.ask("information", _choice, 0);

                switch(_result){
                    case 0:
                    //TODO

                }

            }

        });

    }

Kind regards

Tags: BlackBerry Developers

Similar Questions

  • BB10 - dialogue dilemma & reminder Chaos

    Hi all

    I'll try and make this short. In fact, when the user presses on delete, I want a dialogue box appears asking them to confirm. If they hit Yes, the ID of the associated element will be removed.

    It works:

    function setOnclickDelete (paramID) {}
    document.getElementById('overflow-btn-delete').onclick = function() {}

    var r = confirm ("delete permanently this point?");
    If (r == true) {}
    DB.transaction (function (tx) {}

    tx.executeSql ("DELETE FROM ARTICLES WHERE id =?', [paramID], function () {}");
    });
    bb.popScreen (this);
    }

    };
    }

    But this isn't the right way to do it. The title is not customizable and so to bed 'JavaScript Confirm'. I took a glance to the API and am halfway there.

    Can detect which button the user presses (delete or cancel):

     

    function setOnclickDelete (paramID) {}
    document.getElementById('overflow-btn-delete').onclick = function() {}

    standardDialog();

    };
    }

    function dialogCallBack (selection) {}
    Alert (Selection.Return);
    }

    function standardDialog() {}
    try {}
    () blackberry.ui.dialog.standardAskAsync
    "Are you sure you want to permanently delete this item?
    blackberry.ui.dialog.D_DELETE,
    dialogCallBack,
    ({title: 'Delete?'});
    } catch (e) {}
    Alert ("Exception in standardDialog:" + e);
    }
    }

    Correctly passes the ID parameter but unable to detect which button has been clicked. (Delete or cancel):

     

    function setOnclickDelete (paramID) {}
    document.getElementById('overflow-btn-delete').onclick = function() {}

    standardDialog();

    };
    }

    function dialogCallBack (paramID) {}
    Alert (paramID);
    }

    function standardDialog() {}
    try {}
    () blackberry.ui.dialog.standardAskAsync
    "Are you sure you want to permanently delete this item?
    blackberry.ui.dialog.D_DELETE,
    function() {dialogCallBack (paramID)};
    ({title: 'Delete?'});
    } catch (e) {}
    Alert ("Exception in standardDialog:" + e);
    }
    }

    My solution seems to be a mixture of both, but I have been unsuccessful in finding a solution so far. Advice, solutions or help will be greatly appreciated.

    Kind regards

    Karel Vuong

    Ahh - right (not too clear of Q)

    Here you go - a fully functional demo...

    
    
    
    Dialog Demo
    
    
    
    
    
    
        
        
    
    
    

    Whenever you want to pass a parameter to a reminder (you can't unless it's your own reminder) you have to work around him, as in dlgdemo() above using an anonymous function with data, you are interested in passing further in the scope of the recall.

    The function (opt) {dodelete (opt.return, param}} passes in dlgdemo() opt and a param scope therefore dodelete() gets two returned the option from the dialog box and the parameter that you want to pass

  • OnClick-button name or ID

    Hello all,.

    I have a small project I want to achieve in javascript to use with photoshop.

    I want to create a window that contains the buttons to trigger scripts, files (.jsx)

    The project is stopped because I can't get the name or the ID of the button clicked.

    I built this script (see below) from a mixture of sources, I found in the documentation...

    The window is created and works of onclick event, I tried many things to get the properties of 'This', but I always "Undetermined" in return...

    Who can show me the right way to achieve the goal?

    Thank you...

    * English is not my native language

    //-------------

    var sSamplesFolderName = locate ('myBibScript'); folder containing the files

    var folderSamples = new file ("/ Volumes/myTools/scripts - macros /" + sSamplesFolderName); path

    var files = folderSamples.getFiles("*.*");

    UI var = / / object dialogue resource

    "dialog box {------}.

    gButtons: Group {------}

    orientation: 'row', alignment: 'just '.

    } \

    }";

    create and position the window

    var win = new Window (ui);

    win.frameLocation = [0,0];

    Win.Opacity = 0.85

    color background

    g = win.graphics; myBrush = g.newBrush (g.BrushType.SOLID_COLOR, [0.75, 0.75, 0.75, 1]);

    g.backgroundColor = myBrush;

    win.cbFiles = new Array();  elements

    var counter = 0;

    for (loop var = 0; loop < files.length; loop ++) {/ / dynamically add items}

    var f = files [loop];

    If (typeof f.open == "undefined") continue;    Skip file

    If (-1! = f.fsName.indexOf(".)) DS_Store')) continue;    Hidden Skip Mac file

    var fName = f.fsName.substring (folderSamples.fsName.length + 1); Retrieves the file name only

    var fNameShort = fName.replace (".jsx","" ""); Deletes the extension

    win.cbFiles [counter ++] = win.gButtons.add ("button", not defined, fNameShort, {name: fNameShort});

    };

    win.gButtons.addEventListener ("click", gButtonsOnClick);

    function gButtonsOnClick() {}

    / *(I just display this alert to debug) I try determine which button has been clicked and display the name or index here * /

    Alert (this.index); Returns "undefined" in the alert box

    }

    Win.Show ();

    //-----------------

    It work?

    UI var = / / object dialogue resource

    "dialog box {------}.

    gButtons: Group {------}

    orientation: 'row', alignment: 'just '.

    } \

    }";

    create and position the window

    var win = new Window (ui);

    win.frameLocation = [0,0];

    Win.Opacity = 0.85

    color background

    g = win.graphics; myBrush = g.newBrush (g.BrushType.SOLID_COLOR, [0.75, 0.75, 0.75, 1]);

    g.backgroundColor = myBrush;

    win.cbFiles = new Array();  elements

    var counter = 0;

    for (loop var = 0; loop< 10;="" loop++)="" { ="" add="" items="">

    win.cbFiles [counter ++] = win.gButtons.add ('button', undefined, loop, {name: loop});

    win.gButtons.children [loop] .onClick = gButtonsOnClick

    };

    function gButtonsOnClick() {}

    Alert (this.) (Text);

    }

    Win.Show ();

  • Debugging of the dialogues - how?

    I have a fairly complicated dialogue and use the procedure step by step to check the variables etc.

    As soon as I press a button in the dialog the corresponding code in the callback routine is executed - no chance for the operation step by step:

    • Set a breakpoint at the beginning of the callback routine
    • Have a breakpoint near the end of the dialogue-setup code
    • Tiptoe away (F11) until the dialog is presented
    • Click on the button
    • I wait now the execution stops at the brakpoint within the callback routine, but this is not done.
    • I know, I'm in this routine, as an alert is performed if it is present.
    • But once the alert theres no chance to use step by step (F11).

    Is this as expected?

    To illustrate: it's the dialogue

    insert-calc-marker.png

    and this is the callback for the button routine == > (next)

    I put a breakpoint at line 2 which is not used at all.

    win.p0.g3.btnNext.onClick = function () {
          goCurrentMarker= GetMarker (oDoc, sMarkerName, "next", goCurrentMarker) ; 
          win.p0.sMarkerContent.text ="";
          gsMarkerText = goCurrentMarker.MarkerText;
          win.p0.sMarkerContent.textselection = gsMarkerText;
        }
    

    Yes, I have test routines (e.g. GetMarker) ins text scripts separated (see my other post of today ' today), but dialogue is different environment and therefore must be tested again (as I learned).

    Do you have ideas about how debug dialogues whithout placing many statements to alert/console?

    Klaus stew

    All knowing the .bp $ (true); statement that I knew not ESTK does not control...

    win.p0.g3.btnNext.onClick = function () {
          $.bp (true);
          goCurrentMarker= GetMarker (oDoc, sMarkerName, "next", goCurrentMarker) ;
          win.p0.sMarkerContent.text ="";
          gsMarkerText = goCurrentMarker.MarkerText;
          win.p0.sMarkerContent.textselection = gsMarkerText;
    }
    

    I thought that the script is executed in the environment of ESTK (even with #target framemaker) during debugging.

    But that's not true.

    • So after inserting the .bp $ (true); Statement
    • must save the script,
    • Run it (F5)
    • The dialog box appears and I click on the button
    • By ESTK the line containing the breakpoint is set
    • And I can't be more

    I have no awareness of the Guide of the JavaScript tools (which in my humble opinion should be titles ExtendScript...) but experiences. The ralationship between the target engine (framemaker) and ESTK is still a mystery to me. The text engine 'target' does not appear in the JS Tools Guide! It is called JavaScript engine.

    Maybe my method of thinking is not up-to-date more...

  • How to attract attention and keep an open dialogue?

    Hello

    I have a dialog that must have informed parameters.

    If the user forgets something, I want to draw attention to him and keep an open dialogue.

    My 'code' is:

    if (w.show() == 1){
         if settings not filled in, alert and exit();
         do work
    }else{ exit() }
    

    The problem is that this way, the dialog box closes and the user must rerun the script.

    So, I made a function onClick for the OK button that checks these settings and alerts if missing.

    However, the main function now not get executed! Press ok does nothing (apart from the verification).

    So I tried to call the main function of the onClick function...

    but then I get an error message "cannot process the request because a modal dialog box or the alert is active"

    What is the correct way to do it?

    How can I alert him if something is missing, but keep open dialogue?

    Thank you

    David

    Hello

    I mentioned initially button.enabled property set to false .

    And Yes - code should collect each required field contents using, i.e. the onChange event.

    If 'all' is true ==> button.enabled = true;

    Just in brief...

    Jarek

  • Pass a function when you call onClick for a button (UI)

    Hello

    I m now studying and I adventure in the creation of the user interface of the Script. I m enjoy!

    I m having the following problem: I have added a button in a dialog box and want to tell script to execute some commands when users click the button. It is therefore a simple (bad example):

    var DLG = new window ('dialogue', 'My dialogue box', [0,0,0,0])

    DLG. Size = [500 500]

    DLG. Location = [300 300]

    var b = dlg.add ("button", [0,0,0,0], "Run")

    b.Location = [20, 180]

    b = [80, 30]

    DLG. Show()

    b.onClick = test () //the problem is here

    function test() {}

    Alert ("test")

    }

    -------

    All is fair. But the onClick event fails the test of the function I m passing! What Miss me?

    I know if I'm using

    b.onClick = function () {}

    ...

    }

    It works... but I´d as the function to call when you call the onClick instead of directly created. Do not know if I m able to explain it better.

    Thank you for the help

    Best regards

    Gustavo.

    The standard would be...

    var dlg = new Window ("dialog", "My dialog", [0,0,0,0])
    dlg.size = [500,500]
    dlg.location = [300,300]
    var b = dlg.add("button", [0,0,0,0], "Run")
    b.location = [20, 180]
    b.size = [80, 30]
    b.onClick = function(){ //the problem is here
    test();
    }
    dlg.show()
    function test(){
      alert("teste")
    }
    
  • Validate the dialogue on the OK button or enter key

    I have a dialog box with a group of checkboxes and buttons OK and cancel. When the user clicks OK or presses ENTER, I want to post other orders and keep the dialogue open if none of the boxes checked. I know how to test the boxes, but I don't know how to do this with an event handler and keep the dialog box open. Any suggestions or pointers would be appreciated.

    Rick

    Here's a way to do

    var w = new Window('dialog');
    var chk1 = w.add('checkbox', undefined, 'check 1');
    var chk2 = w.add('checkbox', undefined, 'check 2');
    
    var btnOk = w.add('button', undefined, 'ok');
    var btnCancel = w.add('button', undefined, 'cancel');
    
    btnOk.onClick = function () {
              //alert('click');
              checked ();
    }
    
    btnCancel.onClick = function () {
              //alert('cancel');
              checked ();
    }
    
    w.show();
    
    function checked () {
              if (chk1.value || chk2.value)
                                  alert('checked');
              else
                        alert('unchecked');
    }
    
  • How to execute the method of dialogue of the handler of a button?

    I created my first dialog of the samples, but I can't find how to execute a method in my handler of a button dialog box. Can someone tell me please in the right direction?

    function CreateDialog()
    {
    this.windowRef = null;
    }

    CreateDialog.prototype.run = function()
    {
    .. .floating a lot of vars

    Create a palette type window.
    var win = new window ('dialogue', 'Spray generator Element', [iTop ILeft then, iWidth, ILeft iTop then + iHauteur]);  Bounds = [left, top, right, bottom]
    this.windowRef = win;

    Add a frame to the content.
    win.btnPanel = win.add ("panel", [iPadding, iPadding, iWidth-iPadding, iHauteur-iPadding], "");

    ... Add a bunch of other things...

    win.btnAdd = win.btnPanel.add ('button', [win.btnRemove.bounds.left - iPadding - iButtonWidth, win.lstImages.bounds.bottom, + iSmPadding, win.btnRemove.bounds.left - iPadding, win.lstImages.bounds.bottom + iSmPadding + iTextHeight], "add");

    win.btnAdd.onClick = function() {}
    TODO implement this
    var f is File.openDialog ("open a file");.
    win.lstImages.add ("item", f.displayName);
    This. EnableControls();    <-problem is on this line here!
    };

    This. EnableControls();  <-this works

    Display the window
    Win.Show ();

    Returns true;
    }

    CreateDialog.prototype.EnableControls = function () {}

    var result = true;
    result = result & & (this.windowRef.ddlPaths.selection! = "");
    result = result & & (this.windowRef.lstImages.items.length > 0);

    this.windowRef.btnOK.enabled = result;
    }

    I posted a response to this here: http://ps-scripts.com/bb/viewtopic.php?t=2889

    X

  • Jdev 11 g + create dialogue with the components of the Trinity

    Hi all
    I tried to create the window of dialogue with ADF Faces component in version 11g Jdev successfully. But when I do the same with the components of the Trinity, I'm not able to get the dialogue window. Nagivation is configured in faces - config.Xml.
    The wait is Onclick of the link "Popup", it should popup with close a dialogue window button.
    Here is the snippet for your reference

    parent. JSPX
    ...
    < tr:document >
    < tr:form >
    < tr:commandLink text = "Popup" id = 'call' action = ' dialogue: child.
    useWindow = "true" windowHeight = "300" windowWidth = "200".
    immediate = "true" / >
    < / tr:form >
    < / tr:document >
    .....

    Child.JSPX
    .............
    < tr:document >
    < tr:form >
    < tr:commandButton text = 'Close' id = 'close' >
    < tr:returnActionListener / >
    < / tr:commandButton >
    < / tr:form >
    < / tr:document >

    ............

    I need to put in place any other property? Please advise me.


    Bernadette

    Just update this post for the benefit of the readers of the forum.

    I've worked with Loganathan offline on it (it is one of my colleagues). The problem is that even if JSPX pages using only the components of Trinidad, the renderket and the skin was still attached to the rich ADF Faces. Change to the rendering engine of trinidad and simple fixed skin issues.

    John

  • Why the story to does not work on onclick in Firefox?

    Why doesn't javascript:history.back() not working on onclick in Firefox? All the form fields are empty if recaptcha filled with evil and the page is reloaded. This works fine on chrome, but not Firefox. Please suggest how we can solve this problem. Make it work like chrome charge back that all fields should not be empty.

    The server sends "no-store" with the page, while Firefox does not store the form once you leave the page. (See attached screenshot).

  • OnClick works not

    I was hoping that someone could tell me why the onclick for the works of blue button 'Try a free search' (allows the clicks) on www.theatrebuddies.co.za using the left button of the mouse... STILL on www.theatrebuddies.co.uk the left button of the mouse does not work and does that using the central button of the mouse... In ADDITION, it will open in a new tab. It's really strange for me.

    The main reason I'm using onclick is for the implementation of Google Analytics.

    I just spent hours and hours of coding of hundreds of onclick variable only discover this confusion why it works on the. co.za site but not the other. Is this a Firefox problem?

    You have the following in your ZA but not your UK:

    _gaq.push(['_setAllowLinker', true]);
    

    Isn't it? Would be an easy fix...

  • Pavilion: Dialogue Assistant de Support HP box won't go away

    My system is automatically updated for Windows 10 last week.  Now I can't get rid where 'reply' to the HP Support Assistant Dialogue 'Important necessary action' pop - it will not respond to cancel, see now or the reporter button and now my task bar icons are not (including my Windows start on the taskbar button.  Assistant HP on my desktop icon does not either - thanks

    Sharosam, welcome to the forum.

    I suggest to uninstall HP Support Assistant and reinstall the latest version here.  Win 10 usually do not play nice with some of the apps of HP.

    Please click on the button + Thumbs up if I helped you and click on accept as Solution If your problem is resolved.

  • Infinite dialogues with 'OK' of bad advertisers can divert Firefox. How can I stop them?

    Some "bad guys" advertisers use a pop-up dialog box that says 'Press OK to continue' or something in that sense. I know that the OK button will be an action that I don't want to leave, but the advertiser operates something in Firefox to infinitely generate dialog boxes again, whenever one is closed, until I press OK. Meanwhile, the Firefox browser does not allow me to close the offending tab or the faulty browser window, so my only escape is the Task Manager. After that is the case I can't restore my previous session because this session contains the hijacker.

    I've included a URL that generated a popup that had this behavior, but it may or may not appear repeatedly, and it seems many other places as well.

    Please take measures so that dialogue may not prevent a tab or a closed browser.

    WARNING: Suite link in "URL of affected sites" can result in unpleasant behavior such browser as described above.

    URL of affected sites

    http://letslikeit.com/page.php?id=19#?= & CB = f1d5be6dcd2e93b & relationship = parent & transport = fragment & frame = f2ee72d7057ecd8 & result = xxRESULTTOKENxx

    There is a bug filed to prevent infinite loop alerts, and until it's resolved, you can install https://addons.mozilla.org/en-US/firefox/addon/13176 that resolves this.

  • Work around a dialogue button in While loop

    I had a crash in VI where the user Alt + right, click on the control and a dialog a button triggers to display the description of the control.  The only bad thing is, the dialog a button inside the decline of the stops of the whole program up to what the user clicks OK in the dialog box.  A way around this problem?  It blocks my program if the user forgets to click OK after a too long.  Any help is appreciated.

    Nathan_S wrote:

    Can't seem to understand why, in its own loop, it freezes the whole program... a little weird.  Take a look at the code if you wish.

    I'm going to guess that this is related to the root 'loop' - there are a few notes here: http://labviewwiki.org/Lessons_learned_from_plugins. Some operations, including the display of dialogs of Windows and menus, go through a section of code that cannot (or at least is not) multithreaded. Any other operation that must also go through this same section of the code crashes until the dialog or menu box is dismissed.

    APOK solution can work, but this dialog VI should always be placed in its own loop, of course - in the case otherwise the dialogue always block the loop in which it is placed (other parallel functions will work, but the loop will not be an iteration) until the dialog box is dismissed.

  • VISA Read blocks. Download dialogue VI reset on abandonment.

    Windows 7 SP1 64 bit

    LabVIEW version 2011 SP1 32-bit

    Version 5.1 of the VISA

    NOR-488. 2 version 2.80

    When you try to communicate with a GPIB instrument (currently a Keithley 2400 source counter), sometimes the VISA Read VI will hang and never come back.  (Timeout value is set to 10 seconds).  Once this happens the VI THAT VISA read call ignores the button cancel in the toolbar.  Close the front panel of this VI will VI resetting: dialogue of the "appeal of VI name.

    Does anyone know what causes this or how to avoid it?


Maybe you are looking for

  • Remove searchqu

    Searchqu and naked Search installed on my laptop, but I think I deleted successfully their. But now I found 3 files linked in the C:\WINDOWS\Prefetch folder. The names are: SEARCHQU TOOLBAR UNINSTALL.EX - 2DC9C271.pf, SEARCHQUMEDIABAR. EXE - 24754703

  • the Windows Firewall has stopped working

    I tried the system restore to just before it stopped working

  • Windows update error 66 has

    66 has the error code when you try to install the update

  • Cannot install XP upgrade after drive failure

    I have a 2nd PC on which I did a Windows XP Home upgrade years ago. The hard drive failed and the upgrade CD will let me install a new hard disk. It is just a backup/test PC and I would keep as an XP system. Is there a way around this problem?

  • display setting

    is there a way to set the contrast of my g6 hp laptop? brightness and contrast too