Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8255183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:26:15+00:00 2026-06-08T01:26:15+00:00

I have this code which creates a floating panel centered to the screen: Ext.define(‘myapp.view.ButtonNav’,

  • 0

I have this code which creates a floating panel centered to the screen:

Ext.define('myapp.view.ButtonNav', {
extend: 'Ext.Container',
xtype: 'myapp_buttonnav',
config: {
    fullscreen: false,
    layout: 'hbox',
    items: [
        {
            xtype: 'button',
            text: 'Button 1',
            listeners: {
                tap: function () {
                    var panel = Ext.Viewport.add({
                        xtype: 'panel',
                        defaultType: 'button',
                        baseCls: 'btn1_cont',
                        centered: true,
                        layout: {
                            type: 'vbox',
                            align: 'center',
                            pack: 'center'
                        },
                        items: [
                            {
                                baseCls: 'btn1',
                                text: 'HOME PAGE',
                                handler: function() {
                                    Ext.Viewport.setActiveItem({
                                        xtype: 'myapp_homepage'
                                    });
                                    panel.destroy();
                                }
                            }
                        ],
                        top: // SET TOP TO SOURCE BUTTON
                        left: // SET LEFT TO SOURCE BUTTON
                    });
                }
            }
        },

    ]        
}
});

As you can see, it is a container, with a button which when clicked shows a floating panel.
How do i position the floating panel centered to the button that triggered the floating panel?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:26:16+00:00Added an answer on June 8, 2026 at 1:26 am

    If I understand correctly, you need to use the showBy function like so :

    myPanel.showBy(myButton);
    

    It will show the panel next to the button and you can choose the alignment as well.

    You can take a look at the documentation

    How to get the button

    If you take a look at the tap listener signature : http://docs.sencha.com/touch/2-0/#!/api/Ext.Button-event-tap

    You can see that the first parameter is the button itself so :

    listeners: {
      tap: function (myButton, myEvent) {
        ... // create your panel
        myPanel.showBy(myButton);
      }
    } 
    

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code, which creates an image, and then adds some effects to
I have developed a program (C#) which creates a SQL database using this code:
I have some code which creates a waitbar: if long_process %user specifies this true/false
I have got this code which creates an image: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
I have this code which should create a splash image with either no animation
I have this code which adds a x number of views to a Multiview
I have this code which does the trick: #include <stdio.h> int main() { int
I have this code which is called at an onChange event of an function
I have this code which gets WP posts, but it gets all the posts
I have this code (which is way simplified from the real code): public interface

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.