Modeless dialogs

Hi,
I am developing under Windows XP, SP2, all updates installed. When I run the program below, the modeless dialog disappears after a few seconds when I click into the parent frame. Obviously the frame repaints and ignores the dialog. But the dialog is still in front of the frame. If you click somewhere in the frame, where the dialog had been shown, the title bar of the dialog reappears. This happens under JRE 1.6.0_03.
If I run under JRE 1.5.0_14, the dialog stays in front visibly, but the frame is also repainted after a click (focus change). This can be noticed because the screen flickers.
Does somebody have a workaround for JRE 1.6.0_3?
Thank you
Jochen
Here the code:
package divtest;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Point;
import javax.swing.JDialog;
import javax.swing.JFrame;
public class ModelessDialogTest extends JFrame {
  public ModelessDialogTest() {
    super("ModelessDialogTest Frame");
    setSize(800, 600);
    setVisible(true);
    Container contentPane = getContentPane();
    contentPane.setBackground(Color.red);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JDialog md = new JDialog(this, "ModelessDialog", false);
    md.getContentPane().setBackground(Color.yellow);
    md.setSize(200,150);
          Dimension parentSize = getSize();
          Dimension mdSize = md.getSize();
          Point parentLoc = getLocation();
          parentLoc.x += (parentSize.width - mdSize.width) / 2;
          parentLoc.y += (parentSize.height - mdSize.height) / 3;
          md.setLocation(parentLoc);
    md.setVisible(true);
  public static void main(String args[]) {
    ModelessDialogTest mdt = new ModelessDialogTest();
}

Bogdan wrote:
> I'm trying to make a modeless window that will open the mails of a
> specific message class. The problem is, that GroupWise traps some
> keyboard events that will never make it to my modeless window. So far
> I'm using modal windows, but that's an issue.
>
> I read this in the c3po documentation:
> "Modeless dialog boxes are best implemented in an out-of-process server.
> Because GroupWise traps keyboard events (to turn them into accelerators
> and eventually into tokens), a .DLL server will experience problems
> receiving keyboard events when creating a modeless dialog box or window."
>
> So, the question is, how do I do that in C#?
Found a solution myself.
I used
System.Windows.Forms.Application.Run(new MyForm());
instead of
Form frm = new MyForm();
frm.Show();

Similar Messages

  • Modeless Dialog Box Not Displaying Contents

    I have created a simple modeless dialog box. Although the dialog box and title appear, the contents (a label) do not appear. The dialog box does display correctly if the dialog box is switched to a modal box.
    I got into this problem because I also cannot get labels to change after their initial display on the main frame. I've tried repaint() and Thread.sleep().
    Please help me, I am a newbie to Java.
    Sincerely,
    John

    I actually had a similar problem with a JDialog containing only a progress bar, which ended up being a problem with Swing rather than my code (the bug report has already been filed). Adding a second component to the dialog fixed the problem, counterintuitive as that seems. Try it and see if that helps... If the label is a JLabel, you might try calling revalidate() on it to get the text to update.
    Ian

  • Help !modeless  dialog in acrobat 9.0

    I want to know how to create a modeless dialog in acrobat 9.0 PRO?   ADM has already been removed from the acrobat 9.0? According to  the javascript reference,i can only create modal dialog boxes.help!thanks

    You can't. As you read, JS dialog windows in Acrobat are modal.
    However, what you can do is pass a reference to the document object to the dialog, and then manipulate it there. It's not exactly the same as having a modal-less window (since the user can't interact with the document directly), but it's better than nothing...

  • Modeless dialogs and the active document

    I have a modeless dialog (Qt) that contains a checkbox to toggle off and on annotations that our plugin draws.  When the user clicks the checkbox, it calls a function in the plugin code that ultimately makes a call to AIAnnotator->SetAnnotatorActive().  When passing in false, the annotations stop drawing, as expected.  But when passing in true, the annotations don't draw (the plugin doesn't even get the kCallerAIAnnotation message) until the modeless dialog moves or the Illustrator window gets focus.
    I have tried to force a redraw and a bunch of other things to try to get the annotations to start drawing, but none of them work.  One thing I found interesting (and is the root of the problem, I suppose) is that at the point the user clicks the checkbox in the modeless dialog, making a call to AIDocument->GetDocument() returns DOC?, which means there isn't an active document.  Without an active document, none of the calls to redraw the window or invalidate the current view will work.
    Have any of you experienced this before and come up with a solution?  I'm really at a loss on what to do.

    Thanks for the response.
    Maybe I'm not calling the AIAppContextSuite functions at the correct time, but they don't seem to do anything in this situation.  I'm pushing the context right before I display the Qt dialog (at which point I have a document and a view), but when the checkbox is clicked, calling AIDocument->GetDocument still indicates there isn't a document.  These click events happen in the Qt event thread, not the plug-in message thread, but I don't believe the click itself is the problem.

  • Whatever happened to Alt+F6 (to switch between modeless dialogs)?

    In all versions of Windows until Vista (I think that was when it went
    missing) you used to be able to press the standard defined accelerator
    Alt+F6 to switch between an application's main window and any modeless
    dialogs it had.
    It's still documented as such here:
    http://msdn.microsoft.com/en-us/library/windows/desktop/bb246447(v=vs.85).aspx
    "ALT+F6
     Switch to next window within application (between modeless secondary
    windows and their primary window).
    For example, in Notepad, when you have its Find dialog open, under
    XP/Windows 2003 (and all earlier Windows versions) you can press
    Alt+F6 to switch between the main window and the Find dialog.
    This keystroke was particularly useful when an application's modeless
    dialog was positioned off the screen and couldn't be clicked on it
    with the mouse. You could press Alt+F6 to activate the modeless
    dialog, then Alt+Space to popup the modeless dialog's menu, then
    invoke the move operation - and get the modeless dialog back on
    screen.
    On all versions of Windows subsequent to XP/W2K3, as far as I know
    there's no way of activating a modeless dialog with the keyboard.
    Does anyone know if there's a substitute keystroke, and if not, out of
    interest why we lost that keystroke?
    Dave

    Are you using KMS?
    I'm not sure but you could try launching your WM from .xinitrc:
    'exec ck-launch-session WM'
    Instead of WM you can try 'startxfce4' 'xfce' or wait for somebody smarter than me :-)

  • How to create a modeless dialog using commandlink

    i want to create a modelessdialog using commandlink. and my code is
    <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <f:view>
    <script language="Javascript1.2">
    function modelesswin(){
    window.showModelessDialog();
    </script>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <h:form>
    <h:commandLink onclick="javascript:modelesswin('popup.html', 300, 300)" value="click"></h:commandLink>
    </h:form>
    </body>
    </f:view>
    </html>
    when i click the buttonlink the dialog box is not in a stable state that is its will appear and within a second it will disappear .. can any one of them can suggest me how to create a modeless dialoge using commandlink or by jsf option button
    regards
    subramanian

    If I had to guess (and I do :), the onclick is firing, bring up the dialog, but the commandLink causes a form submit, so the page is submitted. There is no action on the commandLink, so it's navigating back to the same page, causing it to refresh and your dialog to disappear. It would appear to me that you need a h:outputLink or simply <a href="# onclick="..." /"></a>

  • ScriptUI tab through the fields in a modeless dialog (IDCS4ME)

    Hi,
    I've made a dialog with ScriptUI, a "palette" i.e., modeless. I'd like the user to be able to press the Tab key and shift through the various text input fields etc. But instead, the Tab key hides the InDesign panels even when the dialog has the focus.
    Anyone know how I can get the Tab key to work in a standard way?
    Thanks,
    Ariel

    Thanks Harbs
    Is this the same bug that when typing characters they sometimes are applied to the InDesign document, and sometimes to the dialog?
    If so, does this mean that essentially nobody uses modeless dialogs with ScriptUI on a PC?

  • JS: Persistent Modeless Dialog

    I am trying to make a modeless dialog box for InDesign, but for some reason the dialog always closes after the script runs (i.e. I see the dialog for a brief second until the script finishes running, then it's gone). I cannot get it to persist. I need to be able to edit a document while the dialog is open. Any suggestions?
    I am using the ScriptUI classes to create a dialog with the property 'palette'.

    I tried that, still the same. I can put that at the beginning of the script, right? Along with my application target?
    Example:
    #target InDesign
    #targetengine "session"
    Here is my whole script (don't laugh too hard, I am still trying to figure this out ):
    #target InDesign
    #targetengine "session"
    function closeWindow(){
         posWin.close();
    var posWin = new Window(
         'palette',
         'Position the Image',
         undefined, {
              resizable: false,
              closeButton: true,
              maximizeButton: false,
              minimizeButton: false,
              independent: false,
              borderless: true
    posWin.location = [0, 0];
    posWin.info = posWin.add('panel', undefined, undefined);
    posWin.action = posWin.add('panel', undefined, undefined);
    posWin.action.orientation = 'row';
    posWin.action.prevMaterialBtn = posWin.action.add('button', undefined, '<-- Previous Material');
    posWin.action.cancelBtn = posWin.action.add('button', undefined, 'Cancel');
    posWin.action.cancelBtn.onClick = closeWindow;
    posWin.action.nextMaterialBtn = posWin.action.add('button', undefined, 'Next Material -->');
    // This function will call an instance of a template, delete the link to the current photo, replace it with a new photo and then wait for an onClick (or some other) event.
    // It will then write the information to the XMP, close the template and open the next template.
    posWin.show();

  • Can i create ADM Modeless dialog using Photoshop CS5 SDK

    Hi,
    I am developing a photoshop plugin using CS3 SDK. I am using ADM to create dialogs. Developing ADM Modeless dialog is not possible in CS3 SDK.
    Can any one please tell me whether it is possible in CS5 SDK to create Modeless dialog. ( So that user of my plugin will be free to use photoshop even after invocation of DialogBox. )
    If Modeless dialogs are not possible in photoshop using ADM,..... Is ther any other way to create modeless dialogs in photoshop ??
    Regards,
    Prafulla Vedante

    ADM Modeless dialog is not supported in Photoshop in any version.
    Your only option to make a panel / palette in Photoshop is to use the CS SDK (CS5) or the "Photoshop Panel Developer's Guide" ( CS4 or CS5 ).
    http://www.adobe.com/devnet/photoshop.html
    http://blogs.adobe.com/cssdk/tag/cs-sdk

  • How to create modeless dialog?

    Hi,
    Any body tell me how to create the modeless dialog??

    From your y'day's post...
    See to the VI Properties for what I ve changed.
    - Partha
    LabVIEW - Wires that catch bugs!
    Attachments:
    MainVI.vi ‏18 KB
    SubVI.vi ‏12 KB

  • Modeless dialog on top

    How can I force a modeless dialog to be always on top of its owner?
    Thanks

    It doesn't for me: public class testtttttt extends JFrame implements ActionListener{
         public testtttttt(String arg0) throws HeadlessException {
              super(arg0);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public static void main(String[] args) {
                        testtttttt t = new testtttttt("icon");
                        JPanel p = new JPanel();
                        p.setSize(100,100);
                        JButton b = new JButton("open");
                        b.setPreferredSize(new Dimension(80,25));
                        b.addActionListener(t);
                        p.add(b);
                        t.getContentPane().add(p);
                        t.pack();
                        t.show();
         public void actionPerformed(ActionEvent arg0) {
              Dia d = new Dia(this,"Modal");
              d.setModal(true);
              d.pack();
              d.show();
    public class Dia extends JDialog implements ActionListener{
         public Dia(Frame arg0, String arg1) throws HeadlessException {
              super(arg0, arg1);
              JPanel p = new JPanel();
              JButton b = new JButton("open");
              b.addActionListener(this);
              p.add(b);
              getContentPane().add(p);
         public void actionPerformed(ActionEvent arg0) {
              Dia d = new Dia((Frame)this.getOwner(),"Help");
              JPanel p = new JPanel();
              JTextField f = new JTextField();
              f.setPreferredSize(new Dimension(60,20));
              p.add(f);
              d.getContentPane().add(p);
              d.pack();
              d.show();
    }

  • Click To Activate issue with modeless dialog popup..

    I have a customer that is having the annoying "click to activate control" for applets in IE.    I've been able to fix it for thier normal pages with a fix I found on the internet (why re-invent the wheel right? ) , however they have a few "pop up" windows where they use the  "window.showModelessDialog"  method of opening a new window.    For this window, my usual fix doesn't work...
    I have a feeling that it has to do with opening the window as a modeless diaglog.    Any ideas?
    EDIT
    I realize that this problem will go away in April of 08.  However a significant number of clients machines will not be updated anytime soon (as they are not connected to the internet)
    Edited by: Doug Holtke on Jan 24, 2008 6:50 PM

    Doug,
    You can remove the Windows update that put the lock on the active objects in the first place.  I don't know the patch number off hand but I'm sure you can find it.
    Sam

  • Some progress on modeless dialogs...

    Hi all,
    The last couple of weeks I've been trying to get floating tool windows into photoshop. I'm trying a lot of things and came across this:
    Load up the "FrameSelect" example project and change the DoUI() function to this:
    SPErr DoUI ()
    SPErr error = noErr;
    //int item = kDNoUI; // Error value.
    SaveParameters(); // Save our parameters, just in case.
    if (sADMDialog != NULL)
    sADMDialog->Create
    gPlugInRef,
    "FrameSelection",
    kDialogID,
    kADMTabbedFloatingDialogStyle,
    DoUIInit,
    NULL, /* No user data */
    0//InOptions = 0
    //if (item != kDOk_button)
    // error = 'STOP'; //'STOP' = kUserCancel;
    // RestoreParameters();
    return error;
    The sADMDialog->Create functon replaces the sADMDialog->Modal function that was there. This is all in the standard PS SDK, just had to go hunting through some header files. When yo run this code you sort of have a floating tabbed tool window. There are still some odd thing that happen but this might get some people on the right track.
    G

    Trash CoreCenter, and disable CPU Fan Target in BIOS. Cool 'n Quiet I don't use either. Then you may be able to resolve this much easier!

  • Dialog box display won't update after screen blank or being moved

    I have a modeless dialog box used for status display by a plugin I wrote for Acrobat. Everything works fine until the screen blanks or the user moves the dialog box on the screen, at which point no further updates to the dialog box are displayed. My plugin consumes 100% of CPU for long periods of time so the program can appear dead without this display being updated, but nothing I have tried seems to make any difference. The dialog box is generated with ADM and things I have tried include calling "Update" on the dialog box at regular intervals, the windows "Sleep" function to yield the CPU periodically, and a host of similar tactics.
    I'm guessing all the code will get run together once I click submit, but here is how I create the diaglog box (it was working fine without the "WinAppRegisterModelessDialog", but I saw a reference to it elsewhere and tried it to see if it would help, not sure if it actually serves any useful purpose):
    statWin = sADMDialog->Create(inPluginRef, DIALOG_ID, IDB_DIALOG1, kADMModalDialogStyle, NULL, NULL, 0);
    WinAppRegisterModelessDialog((HWND)sADMDialog->GetWindowRef(statWin));
    infoBox = sADMDialog->CreateItem(statWin, 5, kADMTextStaticType, &coords, NULL, NULL, 0);
    // Status header
    coords.top = coords.bottom + 10;
    coords.bottom = coords.top + 12;
    statHeader = sADMDialog->CreateItem(statWin, kADMUniqueItemID, kADMTextStaticType, &coords, NULL, NULL, 0);
    // Status line
    coords.top = coords.bottom + 10;
    coords.bottom = coords.top + 12;
    statLine = sADMDialog->CreateItem(statWin, kADMUniqueItemID, kADMTextStaticType, &coords, NULL, NULL, 0);
    // Progress bar
    coords.top = coords.bottom + 10;
    coords.bottom = coords.top + 15;
    progress = sADMDialog->CreateItem(statWin, kADMUniqueItemID, kADMProgressBarType, &coords, NULL, NULL, 0);
    sADMItem->SetMinIntValue(progress, 0);
    sADMItem->SetMaxIntValue(progress, totalPages);
    // Set window size, and other attributes
    sADMDialog->Size(statWin, coords.right + BORDER, coords.bottom + BORDER);
    sADMDialog->SetText(statWin, PROD_NAME " - Progress");
    // Set header for status line
    sADMItem->SetText(statHeader, " Page # % Complete Estimated Time remaining");
    // Initialize progress bar
    sADMItem->Update(progress);
    Updates are currently performed with the following code segment. The last two lines are my attempts to get the display to update once the screen blanks:
    // show it
    sADMItem->SetText(statLine, textBuf);
    // Update progress bar
    sADMItem->SetIntValue(progress, pagesCompleted);
    // Force display update/refresh
    sADMDialog->Update(statWin);
    // Yield for display update (in case of screen blank or user changes)
    Sleep((DWORD)100);
    Everything works fine until the window is moved or screen blanking occurs, after that nothing seems to work, all updates to the box cease to be displayed. Any suggestions?

    OK guys here's an update. First I went to BIOS and updated the initial display setting to "LCD panel only" from "Auto". At first I thought it helped, because when I worked at the laptop without the external screen attached, the internal LCD panel resumed normally from off (previously this didn't work).
    But today while I was in the office with my external 19" LCD screen attached, and both of them went off after being idle for 10 minutes, the internal LCD panel didn't resume again. So I've tried the Fn + F5 key combination to switch between modes, and I switched from dualview back to single. The internal LCD panel blinked for a second and then turned off immediately, and from that moment on, I was without picture on both of them. SO I ended up hibernating and resuming again. :( An important note - as soon as the computer began hibernating, the LCD went on and I could see the whole progress of hibernation before it turned off.
    Also another note - when I'm in dualview, I always have keep the internal LCD panel as the primary screen. So unfortunately, when it doesn't resume, I don't have access to the taskbar etc to try more things...
    Any more thoughts?
    Thanks again!
    Rado

  • Modeless window using "palette" does not stay up in CS5

    I am having trouble running a modeless dialog with CS5 (on Windows 64-bit).  My own script does not stay up and neither does the SnpCreateDialog.jsx snippet that  comes with the ESTK and is supposed to demonstrate modeless dialogs.  I have  tried:
    Running from the Scripts panel
    Add #target photoshop
    Being sure the drop-down menu says Photoshop, not CTSK
    as suggested in an older discussion at http://forums.adobe.com/message/3008230#3008230.  (I decided to make a new discussion as that one was marked answered.)
    It also does not stay up when moved into the Photoshop Scripts folder and run from the File menu in Photoshop.
    The relevant code in SnpCreateDialog.jsx is:
    function SnpCreateDialog()
         this.windowRef = null;
    Functional part of this snippet.
    Create a window of type "palette" (a modeless dialog) and display it.
    @return True if the snippet ran as expected, false otherwise.
    @type Boolean
    SnpCreateDialog.prototype.run = function()
         // Create a window of type palette.
         var win = new Window("palette", "SnpCreateDialog",[100,100,380,245]);  // bounds = [left, top, right, bottom]
         this.windowRef = win;
         // Add a frame for the contents.
         win.btnPanel = win.add("panel", [25,15,255,130], "SnpCreateDialog");
         // Add the components, two buttons
         win.btnPanel.okBtn = win.btnPanel.add("button", [15,65,105,85], "OK");
         win.btnPanel.cancelBtn = win.btnPanel.add("button", [120, 65, 210, 85], "Cancel");
         // Register event listeners that define the button behavior
         win.btnPanel.okBtn.onClick = function() {
              $.writeln("OK pressed");
              win.close();
         win.btnPanel.cancelBtn.onClick = function() {
              $.writeln("Cancel pressed");
              win.close();
         // Display the window
         win.show();
         return true;
    "main program": construct an anonymous instance and run it
      as long as we are not unit-testing this snippet.
    if(typeof(SnpCreateDialog_unitTest) == "undefined") {
        new SnpCreateDialog().run();
    If  I put a breakpoint on the "return true;" line, then I can see that the dialog has, in fact, been created and is visible, but it has returned from win.show() and will go away as soon as the script continues.
    Any help would be appreciated.

    Kenneth Evans wrote:
    The advantage of a modeless dialog is that you can continue to do things in Photoshop while the dialog is up.  At least I presume so, since I haven't got one to work, including the ESTK example.
    Sorry but no, most of the Photoshop UI is disabled while a script is running even if the script displays a palette window.
    A dialog window does wait for show() to complete. That is what makes dialogs modal. A palette window does not wait for show() to complete. It runs the rest of the script.
    In the example you posted all the script does after showing the window is return true then ends. Which is why all it does is flash the window. If you put a $.sleep(1000) line before the return true line the windows will display until sleep timeouts then the script will end and the window will close. That is why with Photoshop palette windows are really only useful for progress bars or other script status type windows.
    Although palette windows may allow the user to intreact with the app UI while the window is displayed that doesn't work with Photoshop. The window only displays while the script is running and a running script limits Photoshop UI interaction.
    I have tested palette windows in CS2, CS3, CS4, and CS5 with the same results. The window only shows while the script is running.
    With Photoshop if you want the user to interact with the UI you have to create a panel.

Maybe you are looking for

  • [Consolidation-Locked] Lightroom 4.1 Performance

    hello my lightroom 4.1 copy is so slow, in the develop module when switching between raw files the "loading" logo keeps spinning for a long time before I can edit the file, and the same happens when I click on the image to zoom in, takes forever to d

  • Is it possible to upgrade the graphics card in HP DV7-2043CL?

    Hi guys, I would like to upgrade my old laptop specs in order to improve a little bit its overall performance. The main use is for lite-mid gaming purposes and the first thing that I wish to upgrade is the graphics card of course (currently got HD465

  • Multiple dsl connections in Single Router

    Hi, I am trying to terminate two dls connections to the same provider in a single router. I have two HWIC interfaces in the Router. The router is a Cisco 1841 series. When the dsl line is connected to Slot 0, router is connects without issue. When I

  • How do i sync my iphone if my computer is not recognizing

    How do I sync my iphone to itunes if my computer is not recognizing my device

  • ScoreBook Lite 8.1 App not Showing in Search Results

    This app was initially published about two weeks ago with a few updates since then.  Although I go directly to the app with the provide link it is not showing up in store search results?  Is using keywords enough for search or should there be the sam