[CLOSED] Problem to add panel to tabpanel from code behind

  1. #1

    [CLOSED] Problem to add panel to tabpanel from code behind

    Hello

    Please see code below:
    <%@ Page Language="C#" %>
      
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void showWindow1(object sender, EventArgs e)
        {
            //Declarations
            Ext.Net.Window myWindow = (Ext.Net.Window)MyDesktop.Modules["Test1"].Window[0];
            Ext.Net.Panel myZonePanel= new Ext.Net.Panel{
                Title="Test",
                Width=100,
                Height=100,
                X=10,
                Y=10};
    
            myZonePanel.Render(myWindow);
        }
    
        protected void Tab1Activate(object sender, EventArgs e)
        {
            //Declarations
            Ext.Net.Panel PanelTab1 = (Ext.Net.Panel)Ext.Net.X.GetCmp("tab1");
            Ext.Net.Panel myZonePanel = new Ext.Net.Panel
            {
                Title = "Test1",
                Width = 100,
                Height = 100,
                X = 10,
                Y = 10
            };
    
    
            myZonePanel.Render(PanelTab1);
    
        }
    
        protected void Tab2Activate(object sender, EventArgs e)
        {
            //Declarations
            Ext.Net.Panel PanelTab2 = (Ext.Net.Panel)Ext.Net.X.GetCmp("tab2");
            Ext.Net.Panel myZonePanel2 = new Ext.Net.Panel
            {
                Title = "Test2",
                Width = 100,
                Height = 100,
                X = 20,
                Y = 20
            };
    
            myZonePanel2.Render(PanelTab2);
        }
    
    </script>  
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    
        <body>
    
            <form  id="form1" runat="server">
    
                <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
                <ext:Desktop 
                    ID="MyDesktop" 
                    runat="server">
    
                    <DesktopConfig ID="DesktopConfig1" runat="server" Icons="start-button">
                    </DesktopConfig>
    
                    <Modules>
                        <ext:DesktopModule ModuleID="Test1" AutoRun="false">
                            <Window>
                                <ext:Window
                                    ID="Window1"
                                    runat="server"
                                    Width="400"
                                    Height="400"
                                    ExpandOnShow="True" 
                                    TitleCollapse="false" 
                                    Collapsible="false"
                                    Layout="AbsoluteLayout"
                                    Maximizable="false"
                                    Minimizable="False"
                                    Closable="true"
                                    Resizable="false"
                                    Title="Tes1"
                                    TitleAlign="Center">
                                    <Items>
                                        <ext:DrawComponent 
                                            ID="DrawComponent1"
                                            runat="server" 
                                            ViewBox="false" 
                                            Height="10000"
                                            Width="10000"
                                            StyleSpec="background:white;">
                                        </ext:DrawComponent>               
                                    </Items>
                                    <DirectEvents>
                                        <Show OnEvent="showWindow1"></Show>
                                    </DirectEvents>
                              </ext:Window>
                            </Window>
                        </ext:DesktopModule>
    
                        <ext:DesktopModule ModuleID="Test2" AutoRun="false">
                            <Window>
                                <ext:Window
                                    ID="Window2"
                                    runat="server"
                                    Width="400"
                                    Height="400"
                                    ExpandOnShow="True" 
                                    TitleCollapse="false" 
                                    Collapsible="false"
                                    Layout="AbsoluteLayout"
                                    Maximizable="false"
                                    Minimizable="False"
                                    Closable="true"
                                    Resizable="false"
                                    Title="Test2"
                                    TitleAlign="Center">
                                    <Items>
                                        <ext:TabPanel runat="server" Border="false">
                                            <Items>
                                                <ext:panel runat="server" ID="tab1" Title="Tab1" >
                                                    <DirectEvents>
                                                        <Activate OnEvent="Tab1Activate"></Activate>
                                                    </DirectEvents>
                                                </ext:panel>                                           
                                                <ext:panel runat="server" id="tab2" Title="Tab2">
                                                    <Items>
                                                        <ext:DrawComponent 
                                                            ID="drwVMProcess"
                                                            runat="server" 
                                                            ViewBox="false" 
                                                            Height="10000"
                                                            Width="10000"
                                                            StyleSpec="background:white;">
                                                        </ext:DrawComponent>               
                                                    </Items>
                                                    <DirectEvents>
                                                        <Activate OnEvent="Tab2Activate"></Activate>
                                                    </DirectEvents>
                                                </ext:panel>
                                            </Items>
                                        </ext:TabPanel>
                                    </Items>
                              </ext:Window>
                            </Window>
                        </ext:DesktopModule>
    
                    </Modules>
                    <StartMenu ID="mnuStartMenu" Height="350" Title="Start Here" runat="server" HideTools="True">             
                        <MenuItems>
                            <ext:MenuItem Text="Example 1" Icon="Cog">
                                <Listeners>
                                    <Click Handler="#{MyDesktop}.getModule('Test1').createWindow();" />
                                </Listeners>
                            </ext:MenuItem>
                            <ext:MenuItem Text="Example 2" Icon="Cog">
                                <Listeners>
                                    <Click Handler="#{MyDesktop}.getModule('Test2').createWindow();" />
                                </Listeners>
                            </ext:MenuItem>
                        </MenuItems>
                    </StartMenu>
    
                </ext:Desktop>  
    
            </form>
    
        </body>
    
    </html>
    Example 1 works well

    But on example 2 the activation of Tab2 did not show the panel.

    If I remove the DrawComponent, it works, so whats wrong as same code works weel into the window of example 1?
    Last edited by Daniil; Oct 29, 2013 at 4:13 PM. Reason: [CLOSED]
  2. #2
    Hi @feanor91,

    Well, the DrawComponent has Height="10000" and Width="10000". I guess the added panels are just invisible.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @feanor91,

    Well, the DrawComponent has Height="10000" and Width="10000". I guess the added panels are just invisible.
    Yes I think so too, but why it works if put into a window as in example 1 and not into a panel like example 2?

    And for your information, in my real project, in the window, I draw a jpg picture. And the behaviour is exacltly the same than with DrawComponent, in the window panels are drawn over the picture, if I change window for a panel with the picture in it, panels are hidden by the picture, so is ther a way to draw panel above the component already drawn in tab panels?
  4. #4
    Poblem solved, just have to add Layout="AbsoluteLayout" to panel definition.

Similar Threads

  1. [CLOSED] Activating TabPanel from code behind.
    By bayoglu in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Mar 11, 2013, 2:51 PM
  2. Replies: 1
    Last Post: Jul 07, 2011, 8:34 PM
  3. Replies: 4
    Last Post: Jul 01, 2010, 1:49 AM
  4. Problem TabPanel in code-behind
    By hilbert.blank in forum 1.x Help
    Replies: 2
    Last Post: Jul 09, 2009, 3:16 AM
  5. [CLOSED] Tabpanel in tabpanel from code behind
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 29, 2008, 7:56 AM

Posting Permissions