javauis/lcdui_qt/src/javax/microedition/lcdui/LayoutObject.java
changeset 57 59b3b4473dc8
parent 23 98ccebc37403
equal deleted inserted replaced
56:abc41079b313 57:59b3b4473dc8
   106     Control eswtGetCommandControl(Control ctrl)
   106     Control eswtGetCommandControl(Control ctrl)
   107     {
   107     {
   108         Control ret = null;
   108         Control ret = null;
   109 
   109 
   110         //If the Control is focusable add the commands to the same.
   110         //If the Control is focusable add the commands to the same.
   111         if((ctrl instanceof CaptionedControl) || (ctrl.isFocusControl()))
   111         if((ctrl instanceof CaptionedControl) || (ctrl instanceof Button) 
       
   112 			|| (ctrl.isFocusControl()))
   112         {
   113         {
   113             return ctrl;
   114             return ctrl;
   114         }
   115         }
   115 
   116 
   116 
   117         if(ctrl instanceof Composite)
   117         if(ctrl != null)
   118         {
   118         {
   119             Control[] children = ((Composite) ctrl).getChildren();
   119             if(ctrl instanceof Button)
   120             for(int i = 0; i < children.length; i++)
   120             {
   121             {
   121                 ret = ctrl;
   122                 ret = eswtGetCommandControl(children[i]);
   122             }
   123                 if(ret != null)
   123             else if(ctrl instanceof Composite)
       
   124             {
       
   125                 Control[] children = ((Composite) ctrl).getChildren();
       
   126                 for(int i = 0; i < children.length; i++)
       
   127                 {
   124                 {
   128                     Control result = eswtGetCommandControl(children[i]);
   125                     break;
   129                     if(result != null)
       
   130                     {
       
   131                         ret = result;
       
   132                         break;
       
   133                     }
       
   134                 }
   126                 }
   135             }
   127             }
   136         }
   128         }
       
   129 
   137         return ret;
   130         return ret;
   138     }
   131     }
   139 
   132 
   140     /**
   133     /**
   141      * Dispose LayoutObject.
   134      * Dispose LayoutObject.
   144     {
   137     {
   145         ESWTUIThreadRunner.syncExec(new Runnable()
   138         ESWTUIThreadRunner.syncExec(new Runnable()
   146         {
   139         {
   147             public void run()
   140             public void run()
   148             {
   141             {
       
   142             	owningItem = null;
   149                 control.dispose();
   143                 control.dispose();
   150                 control = null;
   144                 control = null;
   151                 commandControl = null;
   145                 commandControl = null;
   152             }
   146             }
   153         });
   147         });