URGENT: Regaining Focus

Hello everybody!
To get some print screen functionality in Oracle Forms 9i (as the PRINT built-in has proved problematic), I have created a 'Print' button using the HTMLbeforeForm= parameter in formsweb.cfg.
Works like a charm! But... how do I get the focus back to the exact item I was in prior to pressing the button? Currently, I have to click in the java console area to regain the cursor.
Presumably, it's some Javascript?
We're using Sun's JRE and IE 6.
Many thanks

Well I dont have a solution, but this is what I tried and the error that I received. Maybe this will lead you down a better path... I used IE and received this javascript debugging error. I was trying to give the first object tag in the HTML focus. I also tried obj[1] which would be the second object tag and the actual form.fmx. Didnt work. Maybe Im using the wrong HTML tag to get focus? If you view source from the browser you will see that there are two html "object" tags. There's not much else to give focus too? I am using webutiljini.htm.
HTMLbeforeForm=<input Name="Press Me" value="Press Me" type=button onClick="var obj = document.getElementsByTagName('object'); obj[0].focus()"></input>
The error message was..
"Cant move focus to the control because the object is invisible, not enabled, or of a type that does not accept the focus."
Im guessing that an object tag doesnt accept focus. :)

Similar Messages

  • When I close the CHM how do I get the application it was launched from to regain focus?

    I am developing a CHM for an application that runs on
    Windows. When I launch the Help (CHM) from the application, then
    close the Help, I want the application that I launched the Help
    from to regain focus. (I would expect this is what most people
    would want to happen, and this is what happens with Microsoft
    generated Help files.) However with my RoboHelp CHMs this does not
    happen.
    Does anyone know how I can fix this behaviour? Is there a
    setting in RoboHelp that I need to change?
    My R&D application developer has spoken with Microsoft
    and they suggested the problem was with my RoboHelp CHM, they
    suggested trying the following process with one of their CHMs and
    then with one that I created using RoboHelp, and they are correct
    in that my RoboHelp CHM is behaving differently. Here's the
    procedure if you'd like to try it:
    - Open a Windows Explorer window.
    - Navigate to the c:\WINDOWS\Help folder (or equivalent on
    your PC).
    - Double-click on the iexplore.chm file. Note that the help
    file opens up in a viewer window.
    - Dismiss the viewer by clicking on the close button (X).
    - Note that focus is returned to the Windows Explorer window.
    Repeat the above experiment, but navigate to where you have a
    RoboHelp CHM file. I find that when I dismiss the help viewer
    window, focus is NOT returned to the Windows Explorer window. Do
    you see the same thing with your RoboHelp CHMs? If not, what have
    you set to cause the application that it was launched from to
    regain focus?
    I really appreciate any help you can give me in resolving
    this issue.
    Best Regards, Sharon

    Hi Sharon
    Hmmm, where exactly *IS* the focus in your tests after
    closing the RoboHelp generated .CHM file? I just tested and saw the
    same behavior regardless of whether it was a Microsoft .CHM or a
    RoboHelp HTML created .CHM. Each time, the focus was returned to
    Windows Explorer.
    I do know that the manner in which your developers open a
    .CHM can vary. For example, your developer can specify that a
    particular tab have focus, such as the Index or TOC, while simply
    double-clicking will result in the last opened tab being the active
    tab.
    Wish I had more to offer here, but I'm not seeing the same
    behavior as you are. I do know there are some extended settings for
    your window, but I'm doubtful that's the answer here.
    Also, I'm not too sure how much stock I'd put in something a
    Microsoft call center stated. Just the nature of call centers. Some
    folks that staff them are good and skilled, some are a bit, shall
    we say, lacking. This is truly "Luck of the draw".
    Sincerely... Rick

  • Problem when a JPanel with a JDialog regains focus

    I've a simple application with a JFrame and a nested JDialog under MS Windows. When it regains focus (i.e. another application like MSWord was active and with Alt+Tab or with a mouse-click in taskbar I force my application to gain focus), the JDialog becomes active but I can't see the JPanel because between the dialog and the panel there is MSWord. In z-order I've get the dialog at top, under it MSWord and the panel at background. That's not the regular behavior, but sometimes it happens. Any idea to avoid always this behavior?
    Thanks in advance.

    Any solutions to this problem???

  • Regain focus on FormattedTextField when message displayed...

    Hello,
    I have a formatted text field that takes a mask formatter in the form of "####"
    People should fill in a number between 0-9999.
    However, when the focus is put on the next field (a radio button ic), I want to display a messagedialog saying "Please fill in the number" when nothing is filled in.
    So far, so good.
    NOW I would like the formatted textfield to automatically regain the focus after the user has pressed "OK" in the message dialog...
    I have tried putting a requestFocus() right after the messagedialog-code, but then it repeats the message dialog 3 times (requiring to click ok three times) and only then it puts the focus on the text field again...
    Any ideas to make sure the focus is regained after one click?
    (So basically I want to oblige the person to fill in the first field...(and some others!))
    Thank you

    This is the code:
    (don't pay attention to the messy coding rules...I suck at those...) (plus just beginning to program here...)
    public void jdesiredCalFormattedTextField_focusLost(java.awt.event.
    FocusEvent e)
    String cal=new String(jdesiredCalFormattedTextField.getText());
    cal=cal.trim();
    jdesiredCalFormattedTextField.setValue(cal);
    if (jdesiredCalFormattedTextField.getText().trim().length()==0)
    JOptionPane.showMessageDialog(
    null,
    "Gelieve gewenst aantal calorieen in te vullen.",
    "Calorieen foutief!",
    JOptionPane.ERROR_MESSAGE);
    jdesiredCalFormattedTextField.requestFocus();
    else
    jSchemeResultDesiredCalLabel.setText(cal);
    jDesiredResultsOverviewResCalLabel.setText(cal);
    so it checks whether the field is empty (trimmed length==0), if so, it gives the messagedialog, and after the messagedialog it requests focus again...
    Using Java 1.4.2_04
    thnx
    Wouter

  • Urgent! focus problem

    I have panel with two buttons(b1,b2). How could I set focus on b2(or b1) when I add the panel to the frame.
    I have tried b2.requestFocus(), it seems not working until I make a mouse click.
    Please help me.Thanks.

    public void goToButton(final JComponent comp){
    SwingUtilities.invokeLater(new Runnable() {
         public void run() {
              comp.setRequestFocusEnabled(true);
              comp.requestFocus();
    Call this method when panel is added in frame. comp is
    the button.This idea is good, if you show the frame immediately after it is instantiated - but if you do it later, this run method will be processed before the frame is shown with the same result - the focus is not transferred to the component which requests it.
    Another thing - if you want to use comp within the run() method you will have to declare it final; the above code would not compile as posted.
    greetings Marsian

  • CS4: window does not regain focus

    This happens using Dreamweaver CS4 on Windows 7 RC.
    (Untested on Windows XP, Vista.)
    Does not appear to be an issue with Photoshop CS4.
    If DW is in focus and you click on another program's taskbar icon twice it does not re-focus the DW window, which was previously in focus.
    For example:
    I have Dreamweaver open and in-focus (I can type)
    then I click the Firefox icon in the taskbar (Superbar) to preview what I just uploaded (F5)
    then I click the Firefox icon again (my cursor is still there) to minimize it and return to Dreamweaver
    then I start typing.... but the Dreamweaver window is not in focus, even though it is visible and in front
    This works in XP with Photoshop CS2.
    This is not a Windows 7 problem because other programs don't have this problem.
    This is just a minor annoyance, but can anyone else relate to this or is it just me?
    Thanks!

    I see this as a condition common to many applications by many companies...
    First you get the program's attention. (by clicking on it somewhere)
    Then you start typing in it.
    Think of the mess we would be in if you could simply hover your cursor and start typing without clicking...you could wreak havoc without even knowing where your typing is going...wait, that might be a good idea... (not the havoc...)
    Beth

  • Regain focus to TS2 running sequence.

    hi everybody
    i have a TS2 sequence with Labview 7 steps. Labview runs some windows application upon needs.
    when the windows application ends, the Sequence is not focused and sometimes the Labview windows
    opens (and focused),probably by system in spite of the fact that it was minimized , and covers the sequence running steps.
    how to cause the running sequence to gain
    focus, and to prevent the labview window to cover it
    please your advice
    regards
    Simon.I

    Hello Simon,
    Are you using TS 2.0 or 2.01? I have tried to replicate the problem that you have described, but I am not able to. Does this happen for all VIs that get called or just some?
    There are two ways that a VI front panel is shown during a TestStand execution: 1) In the Specify Module dialog box, "Show VI Front Panel When Called" is enabled or 2) In the VI properties, under window appearance, in the customize options, "Show Front Panel When Called" is enabled. But when I try both methods, TestStand still becomes the active window after the VI completes (even if it does not close).
    Of course, as long as the VI is running, it is the active window. You can change that programmatically within the VI by using VI Server to access the properties of the VI itself. Place down a property node. Right-click on it and navigate to "Select Class >> VI Server >> VI". Then right-click on the property and navigate to "Properties >> Front Panel Window >> State". This property allows you to programmatically minimize the front panel of the VI.
    Regards,
    Aaron B.
    National Instruments

  • Dreamweaver pop-ups messages don't regain focus on Windows 7

    For exemple, when I put some files for upload some times DW opens a pop-up for some confirmation. If I change to another program, when I come back to Dreamweaver I can't acess that pop-up, and DW blocks me from clicking on anything else. I use some malabarism to view the pop-up, but normaly I have to wait the pop-up timer expires to continue to use DW. I belive that is a Windows 7 only problem.
    If I try to catch the pop-up on the new Aero Windows taskbar it only opens DW main window, not the pop-up!
    Someone has any ideas?

    Thank you for your anser, let's try this:
    1. Delete a file on the remote server.
    2. While the delete prompt is showing, I switched to another application.
    3. Go back to DW using the thumbnail on Windows 7 taskbar. (it shows two windows, but it doesn't make diference).
    4. The remove file confirm dialog is not visible, and it's very dificult to show it back, normaly right click-n-hold on thumb and drag cursor so you can use the confirm dialog.
    Testing I discoverd that when the prompt is there you can make it disapear simply by clicking on W7 thumb on taskbar. To show it back I have to use my malabarism right-drag click.
    (I'm using W7 64bit with DW CS5. Sorry, I may committed some English errors)

  • Damn These Pesky Applets!

    Whilst searching (in vain) for a solution to my focus issue, I noticed somewhere that the <APPLET> tag is depreciated in favour of the <OBJECT> tag - am I right here? I ask as formsweb.cfg still uses the <APPLET> tag...
    While I'm here, I'll clarify my issue in the desperate hope that something can be done:
    I have a button (created in formsweb.cfg HTMLbeforeForm parameter) that prints the screen using window.print(); This is required as our large rambling Forms application doesn't always enable the PRINT key due to the existence of KEY-OTHERS triggers.
    All's well until the screen print is done and you return to Forms (or at least expect to).
    Even when focus is programmatically taken away from the button, keyboard focus never seems to return to the JVM (in the same window) until you click in one of the text boxes, whereupon the cursor magically reappears and processing can continue. There are no other objects in the window apart from the button and the JVM console.
    This doesn't happen if the Key-F9 trigger is available and a screen print is done via the subsequent dialog, so I'm assuming it's an issue with mixing HTML & Sun's JVM on the same page. Also note that many users' PCs are crashing when KEY-F9 is pressed, so making that globally available within all the forms may not be an answer either!
    I am very frustrated as this would be such an easy workaround to implement as it required just a small amendment to formsweb.cfg
    Users were previously using a terminal emulator to access the forms app, so that tool's Print Screen option was used extensively - they're now using Forms 9i over the web, so this issue has reared it's head.
    Any suggestions gratefully received!

    If you remember I tried to help on this same topic before..
    Re: URGENT: Regaining Focus
    Whilst searching (in vain) for a solution to my focus issue, I noticed somewhere that the <APPLET> tag is depreciated in favour of the <OBJECT> tag - am I right here? I ask as formsweb.cfg still uses the <APPLET> tag...
    I found that the above to be true also while I was searching...
    I think you need to "back the truck up" :) and get back to forms basics and add a key-print to each form and stop trying to reinvent the wheel.
    1) You can use iff2xml90 to convert the forms to xml and then add the key-print xml code to each form. Do a mass change in a text editor to each form. And then use ifxm2f90 to convert them back to fmbs. Once you learn how to do this this slick xml trick, it will be something in your personal form building toolbox for you to use, now and again, for mass changes. Like adding key-print to 50+ forms.
    2) ... Or.. Bite the bullet and open each form in form builder and add a key-print.
    3) ... Or... Post a question on a javascript forum, not here, on how to get focus from and html object (<input type="button" ....>) to an html <object> tag. Javascript experts will know exactly how to accomplish such a thing - or not.
    I also think you mean to say Key-Print not Key-F9 eh?
    If you have computers crashing when Key-Print is pressed then not using key-print is the wrong fix action. Key-print works fine in a normal installation.
    Im recommending getting back to basics. Add Key-Print...
    Message was edited by:
    Mark Reichman

  • Upgraded to Windows 8.1 Pro - new window is losing focus after while

    Hi,
    Just upgraded to 8.1 pro. When new window is opened (any application), after about 5-10 secs focus is lost. And again.... I have to click on window to regain focus. VERY ANNOING WHEN TYPING DOCO
    ANY SOLUTION MR MICROSOFT?
    1. Lodged problem with MS, but bo reply for 5 days
    2. Started reading posts on net - some about mouse behaviour got my attention
    3. Downloaded and installed latest drivers for Microsort mouse
    4. Unpluged 'old' mouse and plugged in new mouse(the same model
    5. Problem solved - no more problems with focus
    6. Conclusion - could ba a problem with Windows upgrade - mouse locked?

    For this problem, May be we can check Event Viewer if it identify the problem.
    In addition, try to make a clean boot or boot into Safe Mode to test whether this problem caused by 3rd problem, service or driver.
    For more details about Clean boot, please refer to the link below:
    http://support.microsoft.com/kb/929135
    Roger Lu
    TechNet Community Support

  • Why, when entering text, I lose focus frequently and get the warning sound

    When writing text, (here, in blogs or any text editors), the object frequently loses its focus and I get the warning sound as I enter text in an area that does not accept this type of input. 
    As I write this, the bars at the top of the page frequently changes from gray to white, and as I try to write the next letter I get awarning sound; to continue entering text, I need to click on the Multi-Touch trackpad to regain focus. I am able to enter only a few characters before I get the warning sound again.          
    any suggestions?
    Mac OS X 10.7.4
    Model Name:          MacBook Pro
      Model Identifier:          MacBookPro6,1
      Processor Name:          Intel Core i7
      Processor Speed:          2.66 GHz
      Number of Processors:          1
      Total Number of Cores:          2
      L2 Cache (per Core):          256 KB
      L3 Cache:          4 MB
      Memory:          8 GB

    Problem resolved by a genius at the local Apple Store.
    The problem was caused by static electricity interacting with the track pad. He placed some srips behind the pad and problem resolved.

  • Keep focus in the same window after opening a new window per key-event

    I have an application in which user can press on a specific key, and that opens a new window in a JFrame. User might want open a few of such windows in a row by changing the cursor position and pressing the same letter key. But the problem is that with every new window Java VM transfers the focus to that new window. User is forced either to click to regain focus, or to move the mouse out-and-in the window, in which case the focus returns to it as well, assuming the X11 style of focus by cursor position of course.
    Is there any way to keep the focus with the window on which the cursor is placed?

    In your ActionListener your code should be something like:
    JFrame anotherOne = new JFrame();
    anotherOne.setVisible(true);
    originalFrame.requestFocusInWindow();If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://sscce.org], that demonstrates the incorrect behaviour.
    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

  • JFileChooser in Applet keeps focus after selection of a directory

    I have spent several days on the following issue, but haven't found any solution so far...
    When I open a JFileChooser out of an Applet and select a Directory, the FileChooser closes as expected, but a text field located on the main applet pane cannot be selected any more (the mouse pointer goes to "text cursor" style when hovering over it, but the text field does not get the focus when clicked). Strangely, the other button on the same pane still reacts to mouse clicks. This happens only when I select a directory, but not when I choose a file. Also, it does not happen, when I click "Cancel" instead of "Open". Furthermore, the problem occurs only using the Firefox plugin, not in the AppletViewer. I even tried to remove the text field from the root pane and add a new one after the file chooser execution, but still it won't regain focus.
    Here's the stripped-down code:
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    public class TestApplet extends JApplet {
        private static final long serialVersionUID = 1L;
        @Override
        public void init() {
            final JPanel rootPanel = new JPanel();
            rootPanel.setLayout(new BorderLayout());
            getContentPane().add(rootPanel);
            final JButton fileChooserButton = new JButton("Start");
            fileChooserButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JFileChooser fc = new JFileChooser();
                    fc.setAcceptAllFileFilterUsed(false);
                    fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                    fc.setMultiSelectionEnabled(false);
                    fc.showOpenDialog(rootPanel);
            JTextField textField = new JTextField();
            rootPanel.add(fileChooserButton, BorderLayout.CENTER);
            rootPanel.add(textField, BorderLayout.SOUTH);
    }And this is the applet.html:
    <applet code="TestApplet.class" codebase="file://home/administrator/workspace/Test/bin" width=100 height=50></applet> This concerns: Ubuntu 9.04 / Firefox 3.6.9 / JVM 1.6.0_20
    Any help or ideas for a workaround would be much appreciated...

    AndrewThompson64 wrote:
    JWS was available as a separate download since Java 1.2. It became bundled with the JRE around 1.4.2, not sure of the micro-version, but it was in the 1.4 era. 1.4 has been relegated to the 'obsolete' pile now, so I think you are safe expecting the end user to be prepared to update to 1.5+ if needed.You don't know my grandma: she isn't prepared to anything, but she wants things to just work ;-)
    For ensuring the user has a minimum of 1.5, see the [Java&#153; Rich Internet Applications Deployment Advice|http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html] for details of the deployJava.js script. It is useful for both applets and apps. deployed using JWS.
    Yes, I already use this script for my Applet, but I hadn't realized that it worked for JWS as well.
    Do you mean like a corporate intranet?Exactly. Another example could be centrally managed laptops connecting over Internet to your application (like the traveling salesman connecting to his task planner)
    ... Can you do a search of the bug DB and if nothing shows up, submit one? The only chance these things will get fixed is if they are reported.I agree with you on that question and I've already had a look (didn't find anything so far)
    Embedded applets are a PITA. I wouldn't disagree, but again, if you want to bring a rich client to the masses, sometimes that's the way to do it (unless you go for ActiveX, which is definitely not an option for me). Anyway, I'll give JWS a try.. and then I'll ask the customer help desk if it was a good idea...
    For example, is there any programmatic way to determine if the embedded applet is not acting as expected? If so, monitor that and on detection, pop a dialog to the user explaining the situation and offering the free floating version from a button click.Well, I have to think a bit more about this. Probably I will just to check if the text field gets the focus after a mouse click, by adding some kind of test inside a MouseListener. If it doesn't get the focus, I would be quite sure that there's a problem... I'll look into this.
    On the other hand, to work around the whole problem, I have found some Open Source Directory Chooser (http://sourceforge.net/projects/jfolderchooser), which looks nice at a first glance, but I didn't have the time to go into it in more detail. I'll just quote you here:
    I cannot say if this will fix the problem. Or perhaps it will fix the problem in that browser/JRE combo., but break it in another. ;)Words full of truth :)

  • JTable focus w/ editable headers

    I have three JTables which act as a core, a row header, and a column header, like a spreadsheet. All tables have mutiple columns/row, and all of the cells are editable. I want one cell among all three tables to be selected/editable at one time. I have tried two separate approches.
    1. on focusLost, clear the selection and stopCellEditing.
    2. on focusGained, clear the selections and stopCellEditing in all the other tables.
    The focusLost solution fails because when you are editing a cell and click outside of the table, the focus doesn't get lost.
    The focusGained solution fails because when stopCellEditing is called, that cell regains focus. Now the very cell which I didn't want to have focus has it again.
    I've been working on this for much too long (was up 'til 5am) and am completely stalled. Any ideas?

    Well I've tried something similar to that, but the "cleanup" is where things really mess up. Say every time I get a focusGain event, I store the table it happened in. The next I get one, just check to see if they're the same value and if not unset the others right? Well unfortunately it doesn't work.
    Say I'm editing (with cursor, ie the value hasn't been saved) in table 2. Now I click on table 1. Table 1 tells the other tables to clearSelection() and stopCellEditing() (to save the value which hadn't been). However, as soon as table 2 gets the call to stopCellEditing, it takes back the focus. Like this
    1. Double click table 2; editing
    2. Single click table 1
    3. Table 1 gets focusGained, tells other tables to clear
    4. Table 2 calls stopCellEditing on itself
    Then, because of the stopCellEditing,
    5. Table 1 gets focusLost
    6. Table 2 gets focusGained
    ... but we should be in table 1!!
    If JTable didn't have a bug, then after step 2 table 2 should get a focusLost event, but it doesn't. The more I think about this problem the more I get stuck. Any brainstorming is appreciated!

  • Giving focus to the program

    I need to make a Java program give focus to itself.
    I'm thinking of a thread that would give focus to the program every second.
    But I dont know how to make it "give focus to this program on the computer". With my searches, I can only find about giving focus to a component of the program, not the program in the computer/os
    The program will run in Windows, so something platform specific would be ok.
    Or any other way to make this Java program regain focus automatically about every second.

    In brief, I need to do it for a barcode system. It's somewhat complicated, the commerce system uses php and is online. In this system, I added an applet which recieves events from a local program (the one I want to auto-focus).
    This local program recieves events from the barcode scanner. But a barcode scanner is stupid, and considered like a keyboard for the computer, so a program must be in focus to recieve the events. The best solution I could think of is to make this local program always takes the focus. The interface of this program would be small (or no interface at al).
    All of this system is done and works correctly. The only piece of this puzzle that is missing is having the local program always recieve events from the scanner.
    The computer that will run it is the "cash regitster" computer for the store, so having this local program always gaining focus is correct. And if needed, this "auto-focus" could be deactivated while the computer is needed for other things.
    So the real point is maning sure the local program gains focus about every second so it recieves the events of the scanner, since the scanner is considered like a keyboard.

Maybe you are looking for

  • Using Unix command lines in java code

    I was wondering if there was a way to run a unix command in java code. I know in C++ there is popen, but i don't know of a way in java. The command i need to run is the whois "domain name" command. Any help would be great! jarad

  • Creating dynamic URL parameters

    I need to access the form value j_username to create a dynamic url but the following JSP code snippet is putting a blank value into �username�. This is before the form is submitted. Any ideas ? <input type="button" name="btnPassword" value="Password?

  • Out  to TV causes lines on macbook screen

    When I output to my TV using the Apple adapter, and as soon as I launch Front Row, my Macbook screen becomes nothing but lines, horizontally. The TV looks fine and I can watch it. This also happens if I'm connected to my TV and use VLC. After this ha

  • Can a table cell be split across pages?

    If I have a table, several rows, and one of the cells is longer than a page, can it be split between pages? I have not  yet found a way to do it. Surely, it can be done. Richard

  • Sudoku Help

    Hi Im new to java and im curently building a sudoku game. At the minute i have a gui class which builds my gui with 81 text fields and a few jbuttons to load save etc. im planning on using a 2d array. i want to be able to load a puzzle into a 2d arra