public virtual void updateFromChild(GuiControl ctrl)
 {
     if (ctrl.internalName == "PopupMenu")
     {
         ((GuiControl)this.FOF("TextEdit")).call("setText", ctrl.call("getText"));
     }
     else if (ctrl.internalName == "textEdit")
     {
         GuiPopUpMenuCtrl popup = this.FOF("PopupMenu");
         popup.changeTextById(popup.getSelected(), ctrl.call("getText"));
         onRenameItem();
     }
 }
Пример #2
0
        public override void onControlDropped(GuiControl control, string dropPoint)
        {
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            string     srcBtn = control["dragSourceControl"];
            GuiControl dstBtn = this;
            GuiControl stack  = this.getParent();

            // Not dropped on a valid Button.
            // Really this shouldnt happen since we are in a callback on our specialized
            // EPainterIconBtn namespace.

            if (stack != dstBtn.getParent() || stack != "EPainterStack".getID())
            {
                console.print("Not dropped on valid control");
                return;
            }
            // Dropped on the original control, no order change.
            // Simulate a click on the control, instead of a drag/drop.
            if (srcBtn == dstBtn)
            {
                dstBtn.call("performClick");
                return;
            }

            int dstIndex = stack.getObjectIndex(dstBtn);

            ETerrainEditor.reorderMaterial(stack.getObjectIndex(srcBtn), dstIndex);

            // select the button/material we just reordered.

            stack.getObject((uint)dstIndex).call("performClick");
        }
 public static void SetToggleButtonValue(GuiControl ctrl, string value)
 {
     if (ctrl.getValue() != value)
     {
         ctrl.call("performClick");
     }
 }
Пример #4
0
        public void updateFromChild(GuiControl child)
        {
            string val = child.call("getValue");

            if (val.AsFloat() == Math.Ceiling(val.AsFloat()))
            {
                val = Math.Ceiling(val.AsFloat()).AsString();
            }
            else
            {
                if (val.AsFloat() <= -100)
                {
                    val = Math.Ceiling(val.AsFloat()).AsString();
                }
                else if (val.AsFloat() <= -10)
                {
                    val = Util.mFloatLength(val.AsFloat(), 1);
                }
                else if (val.AsFloat() < 0)
                {
                    val = Util.mFloatLength(val.AsFloat(), 2);
                }
                else if (val.AsFloat() >= 1000)
                {
                    val = Math.Ceiling(val.AsFloat()).AsString();
                }
                else if (val.AsFloat() >= 100)
                {
                    val = Util.mFloatLength(val.AsFloat(), 1);
                }
                else if (val.AsFloat() >= 10)
                {
                    val = Util.mFloatLength(val.AsFloat(), 2);
                }
                else if (val.AsFloat() >= 0)
                {
                    val = Util.mFloatLength(val.AsFloat(), 3);
                }
            }

            this.setValue(val, child);
            onAction();
        }