Focus Problem -- Two Non Modal Dialogs

Hi ,
In my applet, when user does something which is not allowed, I display an error message box (JOptionPane dialog - modal).
There is another dialog box (non modal) that user
can open to view search results and put it aside the
applet window to do some parallel work.
Now when error message dialog appears, the search
dialog box also pops up even if the user
has put this behind the applet window (by clicking browser window or applet, the search dialog goes behind the window).
Can you please let me know, how can I get rid
of this search dialog (non-modal) popup. I mean
search dialog should remain open but should not
come infront (ie should not get focus) when modal
error message dialog pops up.
NOTE: I don't want to make search dialog
a modal dialog.
Thanx,
[email protected]

Thanks for the reply michael. I forgot to mention particularly during my post that i am facing this problem on Solaris system. Running the same application on windows is working fine. I can't make other non-modal dialogs visibility to false because they should be visible on the screen all the time throught out the application life cycle and making it visible/non-visible doesn't get sense in my application. Does anybody is facing the same problem with Solaris system? Plz help.
Hitesh

Similar Messages

  • Problem with non modal ADM dialog

    I have problem with focus and mouse and keyboard event passing to non modal dialog if some modal window was opened and closed on Windows platform.
    I have this problem in my plugin, but also I did some tests with SDK WordFinder Plugin.There are 2 dialogs open there : CountDialog-non modal dialog and PromtDialog-modal one. I commented all lines in function DeleteCountDialog to leave this dialog on the screen. So, first, when "create page map" menu is selected, CountDialog is appearing and stays on the screen. At this stage, it can be moved and get focus when is clicked.After that, I click on "find word by word offset" and then PromtDialog is appearing. when I close Promtdialog by clicking on OK or Cancel, CountDialog is "freezing" - means, it can not be moved and does not get focus when I click on it.
    Is it known problem ? Is there is some workaround there ?
    thanks in advance,
    Lidia.

    Thanks a lot for your response.
    I did changes as you recommended, but still have the same result.
    So I have WordFinder from Acrobat SDK 8 with only one file changed:WordFinderDlg.cpp - see below.The result is the same:
    1. I open Acrobat->Open some file
    2. Click on "Advanced->Acrobat SDK->Word Finder->create Page Map" menu
    3. "count" non Modal Dialog is opened and working and then stays on the screen and can be moved without problem.
    4. Now I click on "Advanced->Acrobat SDK->Word Finder->find Word By Offset" - Modal Promt Dialog is opened. click some number and then click ok - choosen word is selected in Acrobat. From this moment, first "Count" dialog is frosen - can be selected, can not be moved.
    The only workaround I see here is to create non Modal dialog every time I close Modal one.
    Could you please advice ? May I please send to you project in zip ?
    I really need it ASAP ?
    thanks in advance,
    Lidia.
    ADOBE SYSTEMS INCORPORATED
    Copyright (C) 1994-2006 Adobe Systems Incorporated
    All rights reserved.
    NOTICE: Adobe permits you to use, modify, and distribute this file
    in accordance with the terms of the Adobe license agreement
    accompanying it. If you have received this file from a source other
    than Adobe, then your use, modification, or distribution of it
    requires the prior written permission of Adobe.
    \file WordFinderDlg.cpp
    - Implements a modeless progress dialog and a generic prompt dialog.
    // Acrobat headers
    #ifdef WIN_PLATFORM
    #include "PIHeaders.h"
    #endif
    #include "ADMAcroSDK.h"
    #include "resource.h"
    Constants/Declarations
    static ADMDialogRef countDialog;
    static AVWindow gAVWindow = NULL;
    // Global variables used for simplicity
    const ASInt32 MaxLen = 80;
    static char textStr[MaxLen];
    static char titleStr[MaxLen];
    static char msgStr[MaxLen];
    Modeless Progress Dialog
    /* UpdateCountDialog
    ** Updates the dialog with a new GUI function to show count number
    void UpdateCountDialog(ASInt32 cnt)
    ADMItemRef itemRef;
    itemRef = sADMDialog->GetItem(countDialog, IDC_COUNT);
    sADMItem->SetIntValue(itemRef, cnt);
    sADMDialog->Update(countDialog);
    /* CreateCountDialog
    /** GUI function to delete the count dialog
    void DeleteCountDialog(void)
    // destroy dialog
    /*if (countDialog) {
    sADMDialog->Destroy(countDialog);
    countDialog = NULL;
    // Release ADM
    ADMUtils::ReleaseADM();*/
    /* SettingsCountDialogOnInit
    ** Called to initialize the the dialog controls
    ASErr ASAPI CountDialogOnInit(ADMDialogRef dialogRef)
    ADMItemRef itemRef;
    itemRef = sADMDialog->GetItem(dialogRef, IDC_COUNT);
    sADMItem->SetUnits(itemRef, kADMNoUnits);
    sADMItem->SetIntValue(itemRef, 0);
    return kSPNoError;
    /* CreateCountDialog
    ** Creates the modeless dialog.
    void CreateCountDialog(void)
    // Initialize ADM.
    ADMUtils::InitializeADM();
    // Display modeless dialog.
    countDialog = sADMDialog->Create(sADMPluginRef, "ADBE:Wordfinder", IDD_COUNT_DIALOG,
    kADMNoCloseFloatingDialogStyle, CountDialogOnInit, NULL, NULL);
    Generic Prompt Dialog
    /* PromptOnOK
    ** Called when the user clicks OK. Stores the string entered by the
    ** user.
    static void ASAPI PromptOnOK(ADMItemRef item, ADMNotifierRef inNotifier )
    sADMItem->DefaultNotify(item, inNotifier);
    // get user input string
    ADMDialogRef dialog = sADMItem->GetDialog(item);
    ADMItemRef item1 = sADMDialog->GetItem(dialog, ID_PROMPT_FIELD);
    sADMItem->GetText(item1, textStr, MaxLen);
    sADMDialog->EndModal(dialog,IDOK,FALSE);
    AVAppEndModal();
    AVWindowDestroy(gAVWindow);
    /* PromptDialogOnInit
    ** Called to initialize the dialog controls.
    ASErr ASAPI PromptDialogOnInit(ADMDialogRef dialogRef)
    gAVWindow = AVWindowNewFromPlatformThing (AVWLmodal, AVWIN_WANTSKEY, NULL, gExtensionID, sADMDialog->GetWindowRef(dialogRef));
    AVAppBeginModal (gAVWindow);
    sADMDialog->SetText(dialogRef, titleStr);
    sADMDialog->SetDefaultItemID(dialogRef, IDOK);
    sADMDialog->SetCancelItemID(dialogRef, IDCANCEL);
    ADMItemRef itemRef;
    itemRef = sADMDialog->GetItem(dialogRef, IDOK);
    sADMItem->SetNotifyProc(itemRef, PromptOnOK);
    itemRef = sADMDialog->GetItem(dialogRef, ID_PROMPT_FIELD);
    sADMItem->SetUnits(itemRef, kADMNoUnits);
    sADMItem->SetMinIntValue(itemRef, 1);
    itemRef = sADMDialog->GetItem(dialogRef, ID_PROMPT_NAME);
    sADMItem->SetText(itemRef, msgStr);
    return kSPNoError;
    /* PromptForInfo
    /** Generic prompt dialog that gets a text string from the user.
    /** @return IDOK or IDCANCEL.
    ASInt32 PromptForInfo(const char *title, const char *msg, char *buf, ASInt32 bufLen)
    if (!buf || (bufLen == 0))
    ASRaise (GenError(genErrBadParm));
    // Initialize ADM.
    ADMUtils::InitializeADM();
    // init data
    buf[0] = 0;
    strncpy(titleStr, title, sizeof(titleStr) - 1);
    strncpy(msgStr, msg, sizeof(msgStr) - 1);
    // Dispaly modal dialog to get user input
    ASInt32 rc = sADMDialog->Modal(sADMPluginRef, "ADBE:Wordfinder", IDD_PROMPT_DIALOG,
    kADMModalDialogStyle, PromptDialogOnInit, NULL, NULL);
    // get user input data
    if (rc==IDOK)
    strcpy(buf, textStr);
    // Release ADM
    ADMUtils::ReleaseADM();
    return rc;

  • How to display non modal dialog box in a Dll call from TestStand implemented in visual c

    Dear Jason F.
    Applications Engineer
    National Instruments
    Hello
    I did the same way you told me
    the non modal dialog appeared and
    system hangs and
    giving the error message
    ""SeqEdit.exe-Application Error
    The instruction at �0x047fc5b0� referenced memory at �0x047fc5b0�. The memory could not be �read� ""
    please solve my problem
    and thanks for yours early response
    you can email me at
    [email protected]

    Hi Mkehret,
    Does your dialog have ActiveX controls on it? If your DLL dialog uses ActiveX controls and is not programmed in a certain manner it can hang because of a conflict in the threading model used by the TestStand Engine that is calling into your DLL and the model that is required by the MFC ActiveX Container. If you are using ActiveX controls in your dialog, you need to make special considerations for the threading model MFC dialogs that use ActiveX controls need in order to work properly. The example under \Examples\MFCActiveXContainerDlg illustrates how to appropriately handle this situation as well as explaining why it is necessary.
    Note: The above example displays the dialog as modal, but this is irrelevant to the problem I am describing.
    Again for information on properly creating a dialog class object and displaying it as non-modal refer to the information on MSDN that I referred you to in this post:
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000E98A0000&USEARCHCONTEXT_CATEGORY_0=_8_&USEARCHCONTEXT_CATEGORY_S=0&UCATEGORY_0=_8_&UCATEGORY_S=0
    If your dialog does not use ActiveX controls or after trying the programming method illustrated in the "MFCActiveXContainerDlg" example TestStand still hangs when calling your DLL, try calling your DLL from another environment just to make sure whether the DLL works at all. If the DLL works properly when called by another environment (e.g. VB, VC++, LabVIEW, or CVI), please submit a MINIMAL and REPRODUCEABLE example source project for your DLL for us to look at (please exclude all unnecessary code not required to reproduce the specific problem of displaying the dialog, and include all files necessary to build your dll with any
    specific instructions needed to do so).
    Jason F.
    Applications Engineer
    National Instruments
    www.ni.com/ask

  • Howto create non-modal dialogs using ADF Faces

    I would like to use Dialogs in a non-modal manner.
    Trying to use
    <af:commandLink useWindow="true" action="dialog:infoPopup" blocking="false">
    <af:setActionListener from="#{row.xyId}" to="#{infoPopup.currentId}" />
    </af:commandLink>
    doesn't work as expected. I'll get the dialog, but I can't use the page behind it.
    Alternatively I tried to show the page using Javascript opening the pageInfo.faces, but here I have an order problem. The onClick event is processed first and the #{infoPopup.currentId} will be populated after rendering the JSF page. But I want to show infos depending on the xyId.
    Is there any other way to open windows/dialogs?
    Thanks in advance
    Stephan

    The "blocking" attribute basically just blocks you from clicking the commandLink or commandButton twice (or more) before the first click has been processed by the server and a response has been received.
    It is a very good util for avoiding those unwanted IndexOutOfBoundsExcepions when a user hits many buttons thus sending multiple requests to the server.
    By the way, I'd like to see the answer to the non-modal dialog window, because we have a need for them, too.
    Kind regards,
    dj

  • How to create non-modal dialog box?

    I'm trying to create a non-modal dialog box. The purpose is to show an alarm for the user but should leave the calling VI continuing to run. I have created such a thing -- the problem is that I can't figure out how to get the dialog box to go away! It stops running but the window just hangs around. See the attached VIs and image.
    Thanks in advance for your help,
    Chad
    Attachments:
    alarm_ui.png ‏11 KB
    alarm_ui-2.vi ‏11 KB
    message_to_user.vi ‏11 KB

    Ok, I've attached the files. Thanks for looking at this.
    Chad
    Attachments:
    alarm_ui-2.vi ‏11 KB
    message_to_user.vi ‏11 KB

  • You too can display non-modal dialog boxes: LrDialogs.presentFloatingDialog

    Undocumented function: LrDialogs.presentFloatingDialog
    ref: http://feedback.photoshop.com/photoshop_family/topics/sdk_lrdialogs_presentfloatingdialog_ and_showstringsdialog_undocumented
    This works for displaying non-modal dialog box:
    LrFunctionContext.postAsyncTaskWithContext( "test", function( context )
        local LrPhotoPictureView = import 'LrPhotoPictureView'
        local photo = catalog:getTargetPhoto()
        local pictureView = LrPhotoPictureView.makePhotoPictureView{
              width = 400, height = 400, photo = photo,
        local result = LrDialogs.presentFloatingDialog {
            title = "Thumbnail test",
            background_color = LrColor ("white"), -- required for (uncolored) static_text display, else inside of box is black and so can't see black text.
            contents = vf:column {
                vf:static_text {
                    title = photo:getFormattedMetadata ("fileName"),
                pictureView,
                --vf:edit_field { - no sirve, presumably keystrokes are not trapped by box.
                --    bind_to_object = prefs,
                --    value = app:getGlobalPrefBinding( 'tempForTest' ),
                vf:push_button {
                    title = "Click me",
                    action = function( button )
                        app:show{ info="Pushed" } -- glorified call to LrDialogs.presentModalDialog - works.
                    end,
        -- LrDialogs( app:getGlobalPref( 'tempForTest' ), result ) -- no sirve.
    end )
    Enjoy!
    Rob

    jarnoh wrote:
    there is no way to activate previously opened dialog?
    I assume that to be the case, and so it takes a moment to come up if there is much contents.
    jarnoh wrote:
    Doesn't seem to be really useful
    For me, it would be very useful, if it was reliable, but so far, not so good.
    UPDATE: Bug I thought was in non-modal dialog is also in modal dialog (scrolled_view must not be followed by another components in tabbed container - see comments in code below):
    LrFunctionContext.postAsyncTaskWithContext( "tt", function( context )
        local props = LrBinding.makePropertyTable( context )
        props.tv = 0
        local vi = {
            vf:tab_view {
                vf:tab_view_item {
                    identifier = "t1",
                    title = "T1",
                    vf:static_text {
                        title = "temp1"
                vf:tab_view_item {
                    identifier = "t2",
                    title = "T2",
                    vf:scrolled_view {
                        vf:slider {
                            bind_to_object = props,
                            value = LrView.bind( 'tv' ),        
                    -- with this here, Lr crashes after adjusting slider and then switching tabs - comment it out, and all is well:
                    --vf:static_text {
                    --    title = "this cant be here",
        LrDialogs.presentModalDialog {
            title = "test",
            contents = vf:view( vi )
    end )
    R
    Message was edited by: Rob Cole

  • In Unix, main JFrame focus not regained after modal dialog exit.

    Hi all,
    I'm new to this forum so hopefully this is the right place to put this question.
    I have a relatively simple GUI application written in Java 6u20 that involves a main gui window (extends JFrame). Most of the file menu operations result in a modal dialog (either JFileChooser or JOptionPane) being presented to the user.
    The problem is that when running on Unix (HPUX), the process of changing focus to one of these modal dialogs occasionally results in a quick flash of the background terminal window (not necessarily that used to launch the Java), and the process of closing the modal dialogs (by any means, i.e. any dialog button or hitting esc) doesn't always return focus to the main extended JFrame object, sometimes it goes to the terminal window and sometimes just flashes the terminal window before returning to the main JFrame window.
    I think the problem is with the Unix window manager deciding that the main focus should be a terminal window, not my Java application, since the problem occurs in both directions (i.e. focus from main JFrame to modal dialog or vice versa).
    In most cases of JOptionPane, I DO specify that the main extended JFrame object is the parent.
    I've tried multiple things since the problem first occured, including multiple calls to a method which calls the following:
    .toFront();
    .requestFocus();
    .setAlwaysOnTop(true);
    .setVisible(true);
    ..on the main JFrame window (referred to as a public static object)...
    just before and after dialog display, and following selection of any button from the dialogs. This reduced the frequency of the problem, but it always tends to flash the terminal window if not return focus to it completely, and when it occurs (or starts to occur then gets worse) is apparently random! (which makes me think it's an OS issue)
    Any help appreciated thanks,
    Simon
    Self-contained compilable example below which has the same behaviour, but note that the problem DOESN'T occur running on Windows (XP) and that my actual program doesn't use auto-generated code generated by a guibuilder:
    * To change this template, choose Tools | Templates 
    * and open the template in the editor. 
    package example;  
    import javax.swing.JOptionPane;  
    * @author swg 
    public class Main {  
         * @param args the command line arguments 
        public static void main(String[] args) {  
            java.awt.EventQueue.invokeLater(new Runnable() {  
                public void run() {  
                    new NewJFrame().setVisible(true);  
    class NewJFrame extends javax.swing.JFrame {  
        /** Creates new form NewJFrame */ 
        public NewJFrame() {  
            initComponents();  
        /** This method is called from within the constructor to 
         * initialize the form. 
         * WARNING: Do NOT modify this code. The content of this method is 
         * always regenerated by the Form Editor. 
        @SuppressWarnings("unchecked")  
        // <editor-fold defaultstate="collapsed" desc="Generated Code">  
        private void initComponents() {  
            jMenuBar1 = new javax.swing.JMenuBar();  
            jMenu1 = new javax.swing.JMenu();  
            jMenuItem1 = new javax.swing.JMenuItem();  
            jMenu2 = new javax.swing.JMenu();  
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);  
            jMenu1.setText("File");  
            jMenuItem1.setText("jMenuItem1");  
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {  
                public void actionPerformed(java.awt.event.ActionEvent evt) {  
                    jMenuItem1ActionPerformed(evt);  
            jMenu1.add(jMenuItem1);  
            jMenuBar1.add(jMenu1);  
            jMenu2.setText("Edit");  
            jMenuBar1.add(jMenu2);  
            setJMenuBar(jMenuBar1);  
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());  
            getContentPane().setLayout(layout);  
            layout.setHorizontalGroup(  
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                .addGap(0, 400, Short.MAX_VALUE)  
            layout.setVerticalGroup(  
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                .addGap(0, 279, Short.MAX_VALUE)  
            pack();  
        }// </editor-fold>  
        private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {  
            int result = JOptionPane.showConfirmDialog(this, "hello");  
        // Variables declaration - do not modify  
        private javax.swing.JMenu jMenu1;  
        private javax.swing.JMenu jMenu2;  
        private javax.swing.JMenuBar jMenuBar1;  
        private javax.swing.JMenuItem jMenuItem1;  
        // End of variables declaration  
    }

    It won't comfort you much, but I had similar problems on Solaris 10, and at the time we traked them down to a known bug [6262392|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6262392]. The status of this latter is "Closed, will not fix", although it is not explained why...
    It's probably because the entry is itself related to another, more general, bug [6888200|http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=b6eea0fca217effffffffe82413c8a9fce16?bug_id=6888200], which is still open.
    So it is unclear whether this problem will be worked upon (I suspect that yes) and when (I suspect that... not too soon, as it's been dormant for several years!).
    None of our attempts (+toFront(...)+ etc...) solved the issue either, and they only moderately lowered the frequency of occurrence.
    I left the project since then, but I was said that the workaround mentioned in the first bug entry (see comments) doesn't work, whereas switching to Java Desktop instead of CDE reduced the frequency of the issues (without fixing them completely either) - I don't know whether it's an option on HPUX.
    Edited by: jduprez on Jul 9, 2010 11:29 AM

  • Problem closing a modal dialog in SharePoint 2013

    I have an application page which is opened in a modal dialog in SharePoint. In this dialog I open a document with: createNewDocumentWithProgID 
    and afterwards when I want to close the dialog there is a problem using the call: 
    SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.commonModalDialogClose', 1, 'Selected');
    The call itself works in some contexts when I use it with "SP.SOD.execute", but it always causes other javascript errors to be thrown, and these errors sometimes causes problems with the application page. Below are the error messages and code, but
    my question essentially is: What is causing javascript errors in SharePoint after the close modal javascript function is called?
    The errors that occur in javascipts after commonModalDialogClose has been called are: 
    Unhandled exception at line 4118, column 17 in http://sp2013server/_layouts/15/init.debug.js?rev=hd6vYIlQjxmYnM/9RloMJA==
    0x800a138f - JavaScript runtime error: Object expected
    The javascript code snippet which throws the error (in init.debug.js ?):
    for (i = 0; i < am; i++) {
                    sodDep = mll[i];
                    if (!IsSodLoaded(sodDep) && (bSync || sodDep.state != Sods.loading)) {
                        LoadSodInternal(sodDep, bSync);
    And this error: 
    Unhandled exception at line 1270, column 5 in http://sp2013server/_layouts/15/init.debug.js?rev=hd6vYIlQjxmYnM/9RloMJA==
    0x800a138f - JavaScript runtime error: Unable to get property 'caller' of undefined or null reference
    The javascript code snippet which throws the error (in init.debug.js ?):
    function ULSOnError(msg, url, line) {
        return ULSSendExceptionImpl(msg, url, line, ULSOnError.caller);
    The problem which sometimes occurs in the application page because of these javascript errors is that something in the page becomes null after the errors occur. And then a null reference exception is thrown and the dialog will not close, instead an error message
    is shown. The null reference exception is like this (could be that the web request has become null?): 
    "Server Error in '/' Application. 
    Object reference not set to an instance of an object. 
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below."
    Stacktrace: 
    [NullReferenceException: Object reference not set to an instance of an object.]
       Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostLogRequestHandler(Object oSender, EventArgs ea) +120
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +79
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +164
    olha

    Hi,
    Based on your description, when you use JavaScript close dialogue function in SharePoint, it occurs error.
    In SharePoint 2013, I suggest you can use the JavaScript like below:
    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', closeModalDialog);
    Here is a detailed article for your reference:
    https://msdn.microsoft.com/en-us/library/jj245759.aspx
    Thanks
    Best Regards
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jerry Guo
    TechNet Community Support

  • Swing event queue, modal dialogs, event threads, etc...

    Hey all,
    So I am playing around with the focus manager, swing event thread and event queue, etc. Learned quite a bit. I am also playing around with test automation of our UI, using jfcUnit. I have written a few simple apps to play aorund with record/playback, coding tests, etc. What this thread is about though, is figuring out how modal and non-modal dialogs "take over" the event thread/queue? The reason I ask is, if I put a simple test harness like tool embeded in my app as a separate pop-up modal dialog, and from within it there is a GUI that I can use to select a "Test" to run. Now, when I run this test, jfcUnit needs to run on the main window, not within my non-modal dialog. What I am not sure of, however, is that if by using a non-modal dialog all events will go to the main event thread? I mean, I know if I mouse over my second non-modal frame (spawned from the application frame), that events will trigger for that dialog. I remember reading somewhere that modal dialogs "block" the main event queue, all left over events are given to the newly added event queue (presumably by the modal dialog) and existing left-over events get moved to the event queue. If that is the case, I am curious why events for the "old" queue are moved to the new queue if they were orginally intended for the old queue? I would think a "flush" before adding a new queue would be more appropriate so that the old queue can process all of its intended events.
    Now, I am just about to try this, but I am hoping a non-modal pop-up will not interfere with the jfcUnit running the UI of the main window. I am guessing, however, that it might. How are non-modal dialogs handled in terms of events and the event queue? Is it the same as modal dialogs? Or is there no blockage of the mainwindow event queue? If there is no blockage, than any sort of automation based on relative positions to a window may occur on the non-modal dialog, in which case it's best to hide the non-modal dialog during running of these tests.
    What are your thoughts, or better yet, knowledge of this topic? A decent explanation from a developer standpoint and not from the API's which dont give some of the more detailed info I am seeking is what I am hoping to get out of this.
    Thanks.

    Check this out. First, AWTListener has a LOT of
    different types you can register it for. I ORd all
    them together and when I ran my app, it took almost 30
    minutes for it to show up because of the huge stream
    of events being spit out via System.out. ...Yes, that doesn't surprise me in the least. There's hundreds of events that are fired around, usually unbeknownst to the user for every little thing. Lots of component and container events, in particular.
    Just make sure you OR ( using | not || ) ALL the
    "mask" values you want to watch for. That may be why
    you aren't seeing anything. When I did all that, and
    opened a menu, a ton of events came out.Maybe, I'll try that again, but I did specifically add an ActionEvent mask to get action events, and that should be all I need to get action events on buttons or menu items, and it wasn't getting them for either. It was only getting events on buttons when I used SwingEventMonitor, but not menu items.
    So I don't quite understand enough of the underlying event handling. Although, I suspect it could have something to do with the fact that these are Swing components, not AWT components (which their native peers) and it's pretty clear from AbstractButton (or was it DefaultButtonModel) how ActionEvents are fired, and they don't seem to have any connection to the code that deals with AWTListeners.
    My problem is that I kinda need a way to catch events without having a listener attached directly. Normally, I would have a listener, but there's this situation whereby an action may be triggered before I can get hold of the component to attach my listener to it. Perhaps I can get mouse press/release and just deal with it that way.
    Let me know if you did that and still didn't see what
    you were looking for. After playing with this, I am
    guessing the main reason for AWTListener is to
    register a listener for a specific type of event,
    instead of listening to them all, hence avoiding lots
    of extra overhead. Then again, the main event
    dispatcher must do a decent amount of work to fire off
    events to listeners of specific awt event types.Yes, it's definitely that. There's no point in sending events if no one is listening for it, so it does save some time.
    You are right, popup menus I think are dialogs, I
    don't know for sure, but you can access them via the
    JMenu.getPopupMenu() and JMenu.isPopupShowin().
    However, I am still not getting my test stuff working
    quite right.
    Yes, for menu popups. For a JPopupMenu on a right-click on any component (tree or whatever), I had a need to know about that from any arbitrary application (it's this GU testing app I'm working on), and since the popup menu doesn't belong to any component before it's shown, I couldn't necessarily know about it til it was displayed. I managed to use a combination of HierarchyEvents (using an AWTEventListener) and "component added" ContainerEvents. Not a simple matter, but it seems to work well.

  • Launching JavaHelp with a modal dialog

    Hi,
    I am trying to launch JavaHelp from a modal dialog, which consists of a JTabbedPane with 2 tabs. My code right now checks to see which index is selected, then sets the help ID accordingly. However, when I run my application, JavaHelp simply does not launch. How do I work around the problem with the modal dialog...the code for checking the index is correct, because it works in another part of the application, only that window is not modal.

    hi there
    you can try with       helpButton = new JButton("Help");
          CSH.setHelpIDString(helpButton, helpTopicId);
          if(myHelpBroker != null) {
            helpButton.addActionListener(
                new CSH.DisplayHelpFromSource(myHelpBroker);
          } supposed you initialize myHelpBroker with something meaningful (a valid help broker pointing to the help set in question) and helpTopicId with the id of the topic to be displayed
    HTH
    Ulrich

  • Converting message box from modal to non-modal

    I have created a Dialog box that works well transferring variables but have now come across the need to keep this dialog open while exploring the VIEW and REPORT panels.  I understand non-modal dialog boxes allow for this and would like to convert or rebuild my current dialog  box to non-modal. Is this possible?
    If I have to create a new non-modal dialog box, how is this done?  I have tried several examples that suggest using the SUDDlgCreate instead of SUDDlgShow but with no success.  It doesn't appear clear where the disticntion between modal and non-modal is made.
    Thanks,
    Ben

    Hi All,
    Another thing to look out for is that the modal SUDialog can pass a VBScript variable as a 3rd paramater between the calling VBScript and the called SUDialog.  The Non-modal SUDialog can NOT pass a VBScript variable in this way.
    Otherwise there are no changes necessary in the SUDialog ittself, just the function used to call it as modal or non-modal.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Feature request: make the "transform" dialogs non-modal

    Currently, the transformation dialogs accessible at Object>Transform are modal. I'm talking about "Move…", "Rotate…", "Reflect…", and so forth. These dialogs, when open, lock the user out of any interaction with the artboard other than the "preview" button, until the dialog is closed.
    Even more problematically, they lock the scroll and zoom factor of the current user view, so that there's no way to inspect how a precise numeric adjustment affects a part of the layout outside the current window (or within the current window but very small inside it) without committing the change, inspecting it, and then later undoing if necessary. This creates cycles of tedious user adjustments (especially on small monitors) that really should be possible in one user step, by toggling the preview button on and off, and zooming/scrolling.
    This is contrary to most modern UI design principles, which suggest avoiding modes unless they are truly and meaningfully necessary. I don't think this is one of those cases. Photoshop made dialogs for adjustment layers non-modal with CS4, and while there are issues with the newer interface (see John Nack's Configurator workaround), I think it's a win overall. Illustrator needs to catch up in this regard. I realize there is some pretty serious refactoring involved to do this, but it has to be do-able.
    In the words of Larry Tesler's immortal Subaru license plate: "NO MODES"!

    ...make the "transform" dialogs non-modal...
    What, and bring Illustrator out of the 1980s?! Are you mad, man?
    Just so you know you're not alone; I've been complaining about AI's archaic dependency upon modal dialogs for many years.
    ...I'm fully aware of the Transform panel...observing that there's another way to do it...doesn't really address any of my points here...
    But it's not "another way to do it," because the functionality is not the same. The modal dialogs include crucial functionality that cannot be done in the Transform palette. For example, moving something in terms of distance and direction (diagonally), instead of merely by lame X and Y factors. Or transforming about an off-object center of transformation, rather than merely by the 9-point proxy.
    ...the "preview" isn't updated on keyboard entry, and the "preview" checkbox need to be manually toggled on and off...
    But the preview does refresh (and does not have to be toggled) in response to keyboard entry if that keyboard entry is by the arrow keys. For example: Select something, doubleClick the Scale tool, click your cursor in the Uniform value field, and tap the up/down arrow keys (or press and hold them). The value will increment and the preview will update with each key tap. (Be sure to teach that to your students.)
    That does not, of course, negate the complaint, but it does ameleorate it somewhat. The increments are preset; there are no preference settings for them. (Don't even get me started on preferences that should be doc-specific settings, and vice-versa).
    Nor does the valid point that problematic dialogs abound beyond just those associated with the transform tools, but I do agree with it. For just one of many examples, it's nothing short of idiotic that the Scale fields of Transform Each do not have a uniform scaling lock, and that only percentage fields are provided and no explicit dimension fields. Illustrator is quite saturated with such inconsistencies and half-baked implementations.
    But...you're often arguing with the emotionally attached Illustrator devoted here. So I wouldn't recommend holding your breath. It would probably be more effective teaching Illustrator's shortcomings to your beginning students. Probably one of the easiest ways to explain the problem of modal dialogs is to point out that you can't change the current selection with the dialog open.
    JET

  • Imitate modal dialog by non-modal

    Hi
    I'm trying to achieve modal dialog functionality by non-modal (i have reasons to do that), but I have encountered a real problem:
    calling wait() from EDT is freezing everything. Below is source code, in most cases dialog is created inside action listener (in the EDT), so it is the source of problem:
    public class TestMyDialog {
         public TestMyDialog() {
              final JFrame jFrame = new JFrame();
              JPanel panel = new JPanel();
              JButton button1 = new JButton("open dialog");
              JButton button2 = new JButton("close");
              button1.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e) {
                        System.out.println(SwingUtilities.isEventDispatchThread());
                        Object syncObject = new Object();
                        new MyDialog(jFrame, "title", syncObject);
                        try {
                             synchronized (syncObject) {
                                  syncObject.wait();
                        } catch (InterruptedException ex) {
                             ex.printStackTrace();
                        System.out.println("dialog closed");
              button2.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e) {
                        System.exit(0);
              panel.add(button1);
              panel.add(button2);
              jFrame.getContentPane().add(panel);
              jFrame.setUndecorated(true);
              jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              jFrame.pack();
              jFrame.setVisible(true);
         public static void main(String[] args) {
              new TestMyDialog();
    }And main class:
    * Dialog that imitates modal dialog.
    * @author ggg
    @SuppressWarnings("serial")
    public class MyDialog extends JDialog {
         private Frame ownerFrame;
         public MyDialog(Frame owner, String title, final Object syncObject) {
              super(owner, title, false); // modal = false
              this.ownerFrame = owner;
              JButton button1 = new JButton("close dialog");
              button1.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e) {
                        ownerFrame.setFocusable(true);
                        ownerFrame.setEnabled(true);
                        setVisible(false);
                        dispose();
                        synchronized (syncObject) {
                             syncObject.notifyAll();
              add(button1);
              ownerFrame.setFocusable(false);
              ownerFrame.setEnabled(false);
              setSize(300, 200);
              setVisible(true);
         } // end of constructor
    }Any ideas would be highly appreciated.

    gimbal2 wrote:
    calling wait() from EDT is freezing everything.
    Any ideas would be highly appreciated. What about... don't ever block the EDT?Why do you mean by don't block the EDT? I'm using wait() because I need the calling thread to stop for a while (close dialog) but unfortunately this thread is EDT in case of ActionListeners....
    AndrewThompson64 wrote:
    gregory_33 wrote:
    ..I'm trying to achieve modal dialog functionality by non-modal (i have reasons to do that), ..What are those reasons?It was requirements from my boss, and please don't ask me why.... I just have to try to solve this.
    And thanks for interest for all of you.

  • Acrobat looses windows focus after showing a wxWidgets modal dialog

    Here's a code sample:
         AVWindow dlgWindow = AVWindowNewFromPlatformThing(AVWLmodal, NULL, NULL, gExtensionID, dlg->GetHWND());
        AVAppBeginModal(dlgWindow);
        dlg->ShowModal();                                   // dlg is a wxDialog*
        AVWindowDestroy(dlgWindow);
        AVAppEndModal();
    This works in so far as the wxWidgets window is modal with respect to Acrobat, however when we do AVAppEndModal Acrobat does not get the windows focus back.  In fact some other open application gets it instead, which is a problem for the end user.
    If I take away the Begin and End, I do not get the focus problem, however I do not get the modal nature either.
    Any ideas on how to solve this?
    Thanks
    Simon

    Hi,
    I see this too.
    The only workaround I found is to use Windows api to find the Acrobat window and switch back to it maually. There is a flicker, but at least the user is back in his original window.
    I can confirm this behaviour on Wndows XP, Vista, and 7 in Acrobat 8, Acrobat 9 and Acrobat 10.
    Simple code that works for me:
    void SetWinFocusBackToAA()
        #ifdef WIN_PLATFORM   
            if (gHWND) SetForegroundWindow(gHWND); //AA 8 MDI
            else
                HWND AAhwnd = FindWindow(L"AcrobatSDIWindow", NULL);
                if (AAhwnd) SetForegroundWindow(AAhwnd);
        #endif
    I do not see such a problem on Mac OS X.
    I suspect the problem lies in setting correct parent for the modal window, but I have not been able to find one (for some years now).
    Also this does not happen when the modal wx dialog is a child of another wx windows (a modeless window).
    Polda

  • Modal dialog to a JFrame creates problem in windows XP

    I have a problem with JDialog(modal) when it is set to a JFrame.
    It works when the focus is on the dialog.
    If some other application is selected from the taskbar of the windows XP and selecting back the JFrame, the dialog is not poping up on to the frame but it is hided. The dialog can be accessed by selecting Alt+Tab.
    Any solution for this.Pl help.

    hi!
    you need to create a Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, so that any one can easily understand where you are doing a mistake.
    And don't forget to use the Code Formatting Tags so the code retains its original formatting.
    :)

Maybe you are looking for