1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    46
    Vote Rating
    0
    Zavel is on a distinguished road

      0  

    Question Adding to application launch event

    In sencha designer 2, how can i add code to the application launch function?? Is this only possible by editing the JS files that get generated directly? If i edit the generated JS files, will sencha designer 2 be aware of and pick up those changes when i open it again or simply over-write them?

    Thanks,
    Shane

  2. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    46
    Vote Rating
    0
    Zavel is on a distinguished road

      0  

    Default

    Sorry, i found it on the top left drop down in the code window..

  3. #3
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,485
    Vote Rating
    135
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    Quote Originally Posted by Zavel View Post
    Sorry, i found it on the top left drop down in the code window..
    We are working on some UI changes to make this more apparent.
    Aaron Conran
    @aconran

  4. #4
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Hillsborough, NC
    Posts
    374
    Vote Rating
    109
    worthlutz is a jewel in the rough worthlutz is a jewel in the rough worthlutz is a jewel in the rough

      0  

    Default

    Where did this go? I could not find a way to get add items to application launch in build 360.

  5. #5
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,485
    Vote Rating
    135
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    Click on the Application node, in the bottom right property grid you'll see launch with a plus icon next to it. Click the plus icon and it will add a launch function.
    Aaron Conran
    @aconran

  6. #6
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Hillsborough, NC
    Posts
    374
    Vote Rating
    109
    worthlutz is a jewel in the rough worthlutz is a jewel in the rough worthlutz is a jewel in the rough

      0  

    Default

    Thanks! I cannot keep track of what gets moved. Not complaining, just trying to keep up! I'm sure I'll get the hang of the system soon and be able to guess where to look.

    Keep up the good work.

    Worth

  7. #7
    Touch Premium Member
    Join Date
    Jul 2011
    Posts
    168
    Vote Rating
    1
    georgewr3 is on a distinguished road

      0  

    Default

    I'm new to designer and ExtJS. Why does the previous version create a runnable version of a project without adding any manual code but this new version only adds an empty launch function? Or is that still in process?

  8. #8
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,485
    Vote Rating
    135
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    Quote Originally Posted by georgewr3 View Post
    I'm new to designer and ExtJS. Why does the previous version create a runnable version of a project without adding any manual code but this new version only adds an empty launch function? Or is that still in process?
    No, it should be working. Could you share a sample project with us? I'm sure you probably have some configuration problem.
    Aaron Conran
    @aconran

  9. #9
    Touch Premium Member
    Join Date
    Jul 2011
    Posts
    168
    Vote Rating
    1
    georgewr3 is on a distinguished road

      0  

    Default

    I just created a very simple project with a window which contains a container which contains a button. Everything is designer defaults.

    I then selected the application node, clicked on the + next to launch and the center content window changed to an empty launch function.

    Here is the code it generated (with comments removed and the full paths added for each file). I didn't edit any code. I'm sure I'm doing something wrong but I'm not sure what.

    Code:
    //  PrjRoot/app/view/Viewport.js
    //
    Ext.define('MyApp.view.Viewport', {
        extend: 'MyApp.view.MyWindow',
        renderTo: Ext.getBody(),
        requires: [
            'MyApp.view.MyWindow'
        ]
    });
    
    
    
    
    // PrjRoot/app/view/MyWindow.js
    //
    Ext.define('MyApp.view.MyWindow', {
        extend: 'Ext.window.Window',
    
    
        height: 250,
        width: 400,
        title: 'My Window',
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                items: [
                    {
                        xtype: 'container',
                        items: [
                            {
                                xtype: 'button',
                                text: 'MyButton'
                            }
                        ]
                    }
                ]
            });
    
    
            me.callParent(arguments);
        }
    
    
    });
    
    
    
    
    // PrjRoot/app.js
    //
    Ext.Loader.setConfig({
        enabled: true
    });
    
    
    Ext.application({
        views: [
            'MyWindow'
        ],
        autoCreateViewport: true,
        name: 'MyApp',
    
    
        launch: function() {
    
    
        }
    
    
    });
    
    
    
    
    // PrjRoot/app.html
    //
    <!DOCTYPE html>
    
    
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>testprj4</title>
        <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-4.0.2a/resources/css/ext-all.css"/>
        <script type="text/javascript" src="http://extjs.cachefly.net/ext-4.0.2a/ext-all-debug.js"></script>
        <script type="text/javascript" src="app.js"></script>
    </head>
    <body></body>
    </html>

  10. #10
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,485
    Vote Rating
    135
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    Did you want something in the launch function?

    Because you have set the Window as the initial view it will be created when the application launches. Windows don't show by default though. You probably want to turn on the autoShow configuration on the Window.
    Aaron Conran
    @aconran