コード例 #1
0
        void GenerateToolbar()
        {
            var toolbar = new Toolbar();

            var fileNameTextField = new TextField("File Name:");

            fileNameTextField.SetValueWithoutNotify(fileName);
            fileNameTextField.MarkDirtyRepaint();
            fileNameTextField.RegisterValueChangedCallback(evt => fileName = evt.newValue);
            toolbar.Add(fileNameTextField);

            toolbar.Add(new Button(() => RequestDataOperation(true))
            {
                text = "Save Data"
            });
            toolbar.Add(new Button(() => RequestDataOperation(false))
            {
                text = "Load Data"
            });

            var createNodeButton = new Button(() => { graphView.CreateNode("Dialog Node"); });

            createNodeButton.text = "Create Node";
            toolbar.Add(createNodeButton);

            rootVisualElement.Add(toolbar);
        }