示例#1
0
 static int GetTextField(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         FairyGUI.GButton    obj = (FairyGUI.GButton)ToLua.CheckObject <FairyGUI.GButton>(L, 1);
         FairyGUI.GTextField o   = obj.GetTextField();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#2
0
        void __addedToStage()
        {
            DispatchEvent("onPopup", null);

            if (autoSize)
            {
                _list.EnsureBoundsCorrect();
                int   cnt      = _list.numChildren;
                float maxDelta = -1000;
                for (int i = 0; i < cnt; i++)
                {
                    GButton obj = _list.GetChildAt(i).asButton;
                    if (obj == null)
                    {
                        continue;
                    }
                    GTextField tf = obj.GetTextField();
                    if (tf != null)
                    {
                        float v = tf.textWidth - tf.width;
                        if (v > maxDelta)
                        {
                            maxDelta = v;
                        }
                    }
                }

                if (contentPane.width + maxDelta > contentPane.initWidth)
                {
                    contentPane.width += maxDelta;
                }
                else
                {
                    contentPane.width = contentPane.initWidth;
                }
            }

            _list.selectedIndex = -1;
            _list.ResizeToFit(visibleItemCount > 0 ? visibleItemCount : int.MaxValue, 10);
        }