Override the method close() screen

When I close the GUI of my program part, substantive enforcement will also close, which I don't want to happen.

How can I replace the close method of the screen who resides in a UiApplication?

final class SyncMyGUI extends UiApplication {

    //class simplified for clarity
    SyncMyGUI() {
        MainScreen screen=new MainScreen();
        screen.setTitle(new LabelField(State.VERSION,LabelField.ELLIPSIS));

        //screen.onClose(); //How?
        pushScreen(screen);
}

For completeness, here are two samples.  Not tested or compiled, but the principles should be clear.

Inner class:

final class SyncMyGUI extends UiApplication {

    //class simplified for clarity
    SyncMyGUI() {
        MainScreen screen=new MainScreen() {
            public boolean onClose() {
                // Your code in here
            }
        };
        screen.setTitle(new LabelField(State.VERSION,LabelField.ELLIPSIS));

        //screen.onClose(); //How?
        pushScreen(screen);
}

Class within the class:

final class SyncMyGUI extends UiApplication {

    //class simplified for clarity
    SyncMyGUI() {
        MainScreen screen=new MyMainScreen();
        screen.setTitle(new LabelField(State.VERSION,LabelField.ELLIPSIS));

        //screen.onClose(); //How?
        pushScreen(screen);
    }

    public class MyMainScreen extends MainScreen {
        public MyMainScreen() {
            super();
        }
        public boolean onClose() {
            // Your code here
        }
    }
}

Tags: BlackBerry Developers

Similar Questions

  • Question about rom 9900, override the method object failed

    Before I update the ROM (9900jAllLang_PBr7.1.0_rel2435_PL5.1.0.622_A7.1.0.862_AT_T.exe) for my 9900, I can easily overrides the method of object to change text styles or field label, for example the size of the font, color of the text and so on.

    But, after update, I can always control the color of text, except the font size!

    I can make sure my codes worked properly 'before', I think this must be a problem of system because all my apps cannot resize the font size more!

    Is there any other way to solve this problem? I need your help, thank you! ~

    Code looks OK, but I would like you to try something.  Can you please set the font for the LabelField rather than change the paint of duing fonts.  Then change this:

    LabelField = about new LabelField ("about aid and", USE_ALL_WIDTH |) LabelField.ELLIPSIS) {}
    public void paint (Graphics g)
    {
    g.setFont (Font.getDefault () .derive (Font.BOLD, Font.getDefault () .getHeight (Ui.UNITS_pt) + 2, Ui.UNITS_pt));
    Super.Paint (g);
    }
    };

    to something like this:

    LabelField = about new LabelField ("about aid and", USE_ALL_WIDTH |) LabelField.ELLIPSIS);

    about.setFont (Font.getDefault () .derive (Font.BOLD, Font.getDefault () .getHeight (Ui.UNITS_pt) + 2, Ui.UNITS_pt);)

  • Possible to force overwriting of files when you use the method. render()?

    Hello world

    Hope all are well.  I looked at the documentation available in the Guide scripts of the effects after, but could not find any information on this.  Is it possible to force overwriting of files when you call a rendering method. render() in a script?  I know there is a constant that can be used to force overwriting of .aep project files when you use the method. close() on the app object.  For example, it's documentation:

    Action to run on close. A CloseOptions enumerated value, one of:

    CloseOptions.DO_NOT_SAVE_CHANGES : Close without saving the changes. CloseOptions.PROMPT_TO_SAVE_CHANGES : Whether to save changes before closing.
    CloseOptions.SAVE_CHANGES : automatically record on the end.

    Is there something like this for managing conflicts of files during the rendering process?

    Thank you
    Arie

    That's what I do. It seems to work:

    app.beginSuppressDialogs ();

    myProject.renderQueue.render ();

    app.endSuppressDialogs (false);

    Dan

  • Good day, notification of save my icloud does not close. I pressed the bottun close several times, but he's still on my screen. How this can be fixed.

    Good day, notification of save my icloud does not close. I pressed the bottun close several times, but he's still on my screen. How this can be fixed.

    Restart the device - without loss of data

    1. Restart your iPhone, iPad or iPod touch - Apple Support
  • Is it safe to leave the cover of the keyboard between the keyboard and screen retina when I close the macbook?

    Hi, I have a macbook pro 15 "retina.

    I got the cover of the keyboard (not cheap but decent), and I use it everytime I open my macbook.

    However, I heard that it would be dangerous to leave the keypad cover when you close the macbook. Because it could hurt the sensitive retina screen.

    Is this true?

    Is it safe to leave the cover on my keyboard when I close the macbook? It's a little annoying move coverage of my keyboard everytime I have my macbook to opening / closing.

    If it's dangerous, is there a cover keyboard without danger to the retina on the market?

    Thanks for the help!

    I have used Moshi Clearguard kb current covers on two MacBook Pro, including retina mid-2014, I usually use closed with my Apple display 27 ". I put KB covers on as soon as I bought computers and have never deleted without fingers never touched my keys. I did it because I saw how dirty the kbs in the Apple Store, and the seller told me that once the black keys are oily, it is impossible to clean completely. I started with a silicone rubber cap. Three weeks later, I threw it in disgust and I bought a Moshi to replace.

    Moshi rugs are much thinner and lighter than the silicone rubber ones more adapted, hold their shape better, stay clear longer and are much easier to clean and type through. In addition to the one on my computer Ko, I keep one on the external Apple wireless keyboard which is always exposed on my desk. These caches really keep particulate crud, and they do not interfere with my typing at all. When they are dirty, I rub it in the sink with a detergent and a brush to vegetables, and when possible discoloration becomes noticeable after three or four years, I replace it with new ones.

    My previous MBP, a Core 2 Duo late 2008 unibody model, allows to get much hotter than my current on occasion, and I fear sometimes that heat buildup between the lowercase and the display closed would cook the KB cover or even the screen itself. But that never happened, but I guess it might have helped if any yellowing of the coverage.

    If use you Moshi hiding for seven years, I would never consider a time using a silicone back cover. I did not, and you shouldn't worry about all to close your view on a Moshi.

  • Compaq Presario CQ60 - 120ES: I tried the method that I said but is not working, black screen completely.

    Hello

    The method that I explain a message before did not. I tried with a boteable cdrom and usb

    but they didn't work as I thought or there may be errors with the steps that I followed.

    I'm confused, because it's a new situation for me, he never had a similar situation before.

    Please, if you know the solution, or if you know that this kind of problem have no solution only by software,

    write me about it.

    While I will continue to search for.

    Thank you very much and best wishes.

    Hi @f4t4pmKbZ,

    Please become a member of the HP's Support Forums. I understand that you have a problem with starting the computer. I would like to help you to solve this problem today.

    If you have al the troubleshooting of the message passed, the next step will be the call HP to set up the repair.

    If still have a warranty, please use the following http://www.hp.com/contacthp and create a folder for your question and contact HP. If you do not live in the United States / Canada, please click on the link below to get contact information for your region.
    http://WWW8.HP.com/us/en/contact-HP/WW-phone-assist.html

  • S1 Yoga - how to disable the built-in screen/monitor?

    Hello

    Try to find a way/hotkey to turn off the built-in screen while I'm connected to another external monitor with the Thinkpad S1 Yoga model. Do you know guys how to do?

    I might even remap all keys shortcut by default, if anyone knows how do Similarly, the default values are not too useful to me...

    Thank you!!

    GOTO power options and change the option to close the lid do nothing so when you want the wide screens close the lid and press the power button on the monitor

    like the lock screen method could stop copying them files

    http://www.MakeUseOf.com/tag/3-quickest-ways-turn-computer-screen-Windows/

    There is a program that might be what you are looking for

  • Computer automatically restarts to the password login screen.

    Original title: when I try to start my computor, he goes to the password screen then goes to when windows starts and stops and restarts. someone has an answer please.

    Ditto above, try f4 and tried all possible answers. can not even restart myself because I just can't no matter what screen

    The other post:

    I received an email to my last question, nothing helps.   I tried f2, f12, f8. tried all modes of security. It is just where the scroll bar before your log in / password screen and stops and restarts.  There is a message appears at the end but that's just a quick flash and you can not read.

    have tried all the options in f8, f12 removal always close and restart factory reset options.

    Hello

     
    1. does the computer restart before or after you enter the password?
    2 have you made changes on the computer before this problem?
    3. you receive an error message when the computer restarts?
    4. what all troubleshooting have you tried?
     
    Follow the steps mentioned below and check if that helps.
    Method 1:
    Step 1: Check if you are able to boot to the desktop mode without failure.
    Start your computer in safe mode
    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode
    Step 2: If you are able to boot to the desktop in Safe Mode, I suggest putting in a clean boot state and check.
    To help resolve the error and other messages, you can start Windows Vista by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/kb/929135
    NOTE: After a repair, be sure to configure the computer to start as usual after the same article.
    Method 2: If the method above is not enough, you can perform a startup repair and check. Follow this link for more information.
    Startup Repair: frequently asked questions
    http://Windows.Microsoft.com/en-us/Windows-Vista/startup-repair-frequently-asked-questions
     
     
     
  • OfficeJet J4580 not install correctly regardless of the method

    Long story short, I had to uninstall and reinstall evrything and like last time, it will not install correctly.

    The manual says to unplug the unit before installing the soiftware I did but it ended up installing without ever making me plg inside. I Reboot and "Document Manager" appears and I install other software from here - all except the picture one thing. But things do not work quite as it should. Doctor Scan and printing HP goes to its process and tells me "the comprehensive software solution for this product has not been installed" and then letting his work - install, I get an error without number, or something else to say simply: 'Download failed'. "." And 'Retry' will not work.

    For a HP technician on a Board here I try the following:

    Follow the steps below to update the software to the latest version.

    First step: clear temp directory

    1. tap folder in the race or search programs and files of field

    2 Select all the files in this folder, and then press the delete key to remove. If you receive a message that the file is in use, you will need to ignore this file (s).

    3. proceed to step 2 below

    Second step: downloaded and extracted to your system:

    1 download the drivers and full software features

    http://h10025.www1.HP.com/ewfrf/wc/softwareDownloadIndex?softwareitem=MP-79309-1&cc=us&DLC=en&LC=en&...

    2. once the download is complete, double-click the file to extract the software.

    3. when the installation window opens, press the Cancel button to stop the installation

    4. tap folder in the race or search programs and files of field

    5. Locate and open the folder starting with 7z (example: 7zS2356)

    6. right click on the folder and select copy

    7. close this window and all open windows, and then in the Middle the desktop right click your mouse and select Paste. This will move the 7z folder on your desktop.

    8 open the 7z, that you just copied on your desktop

    9 open the Util folder

    10 open the CCC folder

    11 start the uninstall_L4

    12. once the uninstall is complete, restart the computer

    13. run disk cleanup from the tools Accessories\ system under all programs folder

    14. download and install the latest version of Adobe flash player

    15 open the 7z folder and then double-click the Setup.exe file that will be towards the bottom of the open window. Follow the instructions on the screen to reinstall your printer.

    The problem is not # 12: when uninstalling filled to restart the computer

    No uninstall never happens.

    In any case then by downloading the installer to complete the installation of the window program tells me to plug in my cable. Well guess what. It is plugged in, but somehow, he thinks that it is not (although any other tried suggests that another part of the HP "brain" knows it's as the other things would have happened if it is not plugged in)

    In any case I unplpug and reconnect, I reboot etc etc he still thinks that he's not pliugged in - even if step to ignore the "plug the cable into the part is taken.

    Back doctor's Scan and the same thing happens mentoned above.

    On my 1st installtion, way at the time where this printer gave me similar headaches, but many things were that it is impossible for me to rmember what finally worked.

    Oh yes my OS: Windows 7 Home Premium 64-bit

    Thank you

    I solved my problem on my own. Here's how:

    The method you mentioned has already been tried.

    The problem was, I think, to uninstall the HP OfficeJet J4580 and its software a lot, but a lot of files and folders remain and are scattered everywhere and not just in the Program Files folder. This is also true for the registry entries.

    So I was all uninstall again and this time made a search for everything under HP and Hewlett-Packard and remove all. After which I also used CCleaner to enter the remaining things in the windows registry - all carefully in all cases to ensure that I have do not uninstall, delete, or remove things dealing with my HP webcam.

    Doing so and after a few reboots installation again and this time things developed accordingly.

    I must say thatat first, it did not seem as if I had managed since the installtion software always kept thinking my HP wasn't pluggen in and connected. but he has been wrong on reboot everything has worked (except that I had to return to the installtion to install other software associated with it.

    Thanks for your help

  • How to draw and the positioning of images in FieldManager using the method object?

    How can I add and the positioning of my images in the position desired in FieldManagers?

    I need to add more than 2 fields (HorizontalFieldManager/VerticleFieldManager) in my application and I draw an image using the method of painting ovverided.

    NOTE: The image will be established if I do not use mainScreen.add (SeparatorField ()) or mainScreen.add (hori2), see below.

    If I use mainScreen.add (mainScreen.add (hori2) SeparatorField ())... n then the horizontalFieldManger won't be empty, drawn in the output screen.

    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.system.*;
    
    public class BackgroundImage extends UiApplication
    {
        private Bitmap backgroundBitmap;
        private Bitmap fieldBitmap;
    
        int width, height;
    
        public static void main(String[] args)
        {
                BackgroundImage theApp = new BackgroundImage();
                theApp.enterEventDispatcher();
        }
    
        HorizontalFieldManager hori2;
    
        public BackgroundImage()
        {
            //The background image.
            backgroundBitmap = Bitmap.getBitmapResource("jalan_logo.png");
    
            MainScreen mainScreen = new MainScreen();
    
            hori2 = new HorizontalFieldManager();
    
            HorizontalFieldManager horizontalFieldManager = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.USE_ALL_HEIGHT){
    
                //Override the paint method to draw the background image.
                public void paint(Graphics graphics)
                {
                    System.out.println("come to here..!!");
                    width = graphics.getScreenWidth();
                    height = graphics.getScreenHeight();
                    //Draw the background image and then call paint.
                    graphics.drawBitmap(width/2, height/2, 150, 40, backgroundBitmap, 0, 0);
                    super.paint(graphics);
                }            
    
            };
    
            //The LabelField will show up through the transparent image.
            LabelField labelField = new LabelField("This is a label");
    
            //Add the manager to the screen.
            mainScreen.add(horizontalFieldManager);
    
           mainScreen.add(new SeparatorField());
           mainScreen.add(hori2);
           hori2.add(labelField);
    
            //Push the screen.
            pushScreen(mainScreen);
        }
    }
    

    Help, please.

    I have already pointed out the problem with USE_ALL_HEIGHT in first Manager add you to the form. Drop this style bit, otherwise sublayout your screen will generate an exception, and nothing appears!

    If you want HorizontalFieldManager to be of a particular size, regardless of the height of managed fields, replace its sublayout:

    HorizontalFieldManager fieldManagerTopBanner = new
             HorizontalFieldManager()
    {
         protected void sublayout(int maxWidth, int maxHeight) {
            super.sublayout(maxWidth, maxHeight);
            int myDesiredHeight = ;
            setExtent(getWidth(), Math.min(myDesiredHeight, maxHeight));
         }
    
         protected void paint(Graphics g)
         {
              // g.setBackgroundColor(0x000000);//blue
                 g.drawBitmap(100, 150, 100, 200, jlnLogoImg, 0, 0);
    
              //g.clear();
                super.paint(g);
         }
    };
    
  • Return a value from the pop-up screen

    Long story short - I have a PopupScreen. This has two text boxes. What I want to do is to call a method on the original screen (the one that calls the popup), using these values in two text box.

    The only thing I can't do is pass back the two field values. Ive tried to call the method. Even tried passing the screen in the popupscreens constructor.

    private class goToMenuItem extends MenuItem {
            public goToMenuItem() {
                super( new StringProvider( "Test" ), 0, 0 );
            }
            public void run() {
                CustomPopUpScreen cstmScreen = new CustomPopUpScreen();
                UiApplication.getUiApplication().pushModalScreen(cstmScreen);
            }
         }
    
     public class CustomPopUpScreen extends PopupScreen {
    
                BasicEditField T1;
                BasicEditField T2;
    
                public CustomPopUpScreen() {
                    super(new VerticalFieldManager(CustomPopUpScreen.NO_HORIZONTAL_SCROLL));
    
                    BasicEditField T1= new BasicEditField( "T1: ", "", 20, BasicEditField.EDITABLE | BasicEditField.FILTER_REAL_NUMERIC);
                    BasicEditField T2= new BasicEditField( "T2: ", "", 20, BasicEditField.EDITABLE | BasicEditField.FILTER_REAL_NUMERIC);
    
                    ButtonField cancel = new ButtonField("Cancel");
                    ButtonField submit = new ButtonField("Go To");
                    add( T1);
                    add( T2);
                    add(submit);
                    add(cancel);
    
                    cancel.setChangeListener( new FieldChangeListener() {
                        public void fieldChanged(Field arg0, int arg1) {
                            close();
                        }
                    });
    
                    submit.setChangeListener( new FieldChangeListener() {
                        public void fieldChanged(Field arg0, int arg1) {
                            GoTo();
                            close();
                        }
                    });
                }
    
                public void GoTo()
                {
                        //GoTo(Double.parseDouble(T1.getText()),Double.parseDouble(T2.getText()));
                }
            }
    

    Just to add a bit to the response of Simon.

    "I want to do is call a method on the original screen.

    OK, I have to ask, why do you do this?  It doesn't seem very object ish.

    If you want to call this method once the screen has been closed, then the approach you use (modal form) works, you need to get the values in the treatment of menu and then you can call the transformation of in the menu on the screen who has access to the treatment method.

  • Enter key doesn't work is not for the pop-up screen

    Hello

    I am facing a problem in trying to close the context menu in my application. The enter (return) key does not work on my popup screen. I can close the popup with button screen central trackball or with the pointer of the mouse (in Simulator 9800). I want to close the same screen by using the Enter key. I develop application for Blackberry 9800 with OS 6.0 and also the part of the code I am using is as

    PopupScreen messageScreen = new PopupScreen(new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL)); messageField=new BasicEditField("Message:","Abc",20,Field.READONLY);
    closeButton=new ButtonField("Close", Field.USE_ALL_WIDTH){
      protected boolean navigationClick(int status, int time) {
        getScreen().deleteRange(0, getScreen().getFieldCount()-1);
        UiApplication.getUiApplication().popScreen(getScreen());                return true;
      }
    };messageScreen.add(messageField);
    messageScreen.add(closeButton);
    UiApplication.getUiApplication().pushScreen(messageScreen);
    

    Someone help me please on this issue.

    Thanks in advance

    Hi paabs,

    Here's what you need to do:

    1. create a function for each of your buttons. For example: okClicked() & cancelClicked().

    2. replace keyDown and check if the key pressed is the Enter key. If so, check the field with the focus and activate the correct function.

    3 replace the method "navigationClick. Locate the field with the update and select the correct function.

    E.

  • Firefox does not appear in "partial" mode I can't get the display full screen or reduced display, not the intermediate partial screen window.

    The 'partial screen' icon does not work. When it is selected, the screen is reduced to the minimum. (Hover displays the text 'restore down', that doesn't look right.)

    When the screen is reduced to a minimum, I have to hover over the preview, right - select optimize for any screen at all, and it's the display full screen.

    Difficulty? I tried to uninstall/re-install has not fixed the problem.

    Hello rclacher, try this to reset the settings of user interface in firefox: go in firefox > help > troubleshooting information, click on file/show profile folder and close all firefox windows later. a windows Explorer window should open upwards - in there remove the file named localstore.rdf - it will be regenerated the next time you launch the browser.

  • Satellite P300 itself keeps restarting after the initial splash screen.

    My Satellite P300 itself keeps restarting after the initial splash screen.

    Start-up of the first screen with the F2 and F12 options down is displayed, the screen goes black, then a cursor appears in the upper left corner and flashes once or twice. Then the laptop stops and restarts and goes through the same process again and again.

    That's all with the power adapter is plugged in. If disconnected, he goes through the above process and close with no reboot.

    Any help or advice would be much appreciated.

    Post edited by: aic-poppy

    Start your laptop and enter the settings of the BIOS (F2). Set to its default value. Restart your computer, and press F8 to access the advanced boot menu.
    To start the laptop in safe mode and let us know if it works, try it please.

  • HP Pavilion G7-2022US: no backlight on the LCD of the G7-2022US screen, but the video can be seen on external monitor

    I'm trying to fix the HP Pavilion G7-2022US laptop from a friend, the number of product B4Z74UA.  The laptop starts in Windows 7, but the screen is dark even during the BIOS or by MAIL.

    Symptoms:
    Laptop turns on but the LCD screen stays dark (during the POST and when Windows loads)
    With the help of a flashlight on the display shows that the video is present but the backlight does not work
    The video can be seen on an external display connected via VGA cable

    What I've done so far:
    Installed a new LCD screen cable
    Installed a new LCD screen
    Update BIOS
    Updated graphic driver
    check that the lid close switch works (small magnet under the screen that signals the motherboard to turn off display when the lid is closed)
    Static discharge by keeping the button depressed with battery and power adapter disconnected
    Checked if RAM could be bad

    I tried all the solutions above, but the screen remains dark.  The only way to use the laptop is to connect it to an external monitor.  I disassembled the laptop together and there is no inverter part to replace.

    I don't know what else to do.  Any suggestions?

    I finally found the culprit.  A circuit of (possibly a fuse mounted on surface) on the motherboard next to the display cable connector is visibly burned.  The circuit is too damaged to solder and close the connection.

Maybe you are looking for

  • HP Pavilion 15ab522tx laptop: video card

    Can I put a video card in the hp Pavilion 15-ab522tx model? a high-end graphics card?

  • HP G62-b24eo: can not get hdmi sound HP G62-b24eo

    Hello I can't sound to work on my laptop to my lg 32 tv(32LC51-ZA). (Video works) When I go into audio setting is no hdmi in option. (it is not regonize my tv and I clicked on see the disabled devices) but when I connect the laptop to my new sound, t

  • Satellite U400-15B - Windows 7 upgrade Question

    Hello world I upgraded my Vista Home Premium to WIndows 7 through the upgrade DVD Toshiba. I was just wondering, has anyone tried a clean install of Windows 7? My purpose, I would like to make a facility and have no record of my Vista install, so wan

  • iPhone App cannot connect

    Hello I have activated ReadyCloud for the first time yesterday on my NAS204 (OS 6.5.0) and downloaded the new App (V1.57). After starting the application, my SIN is found and marked online. After tapping on it, I see my files and "Connecting" message

  • Acer Aspire T3 - 710

    Hi all I was wondering how to activate the turbo boost function of the CPU (max speed of 3.4 Ghz, with Turbo Boost 4.0 Ghz) with its acer aspire model; 10 64-bit Windows Home Intel Core i7 @ 3.40 GHz Skylake 6700 16 GB of Dual-Channel DDR3 RAM Card m