public vcWorkNumlet CreateNumletSolve(vcWorkNumlet numlet) { // Setup the numlet var _control = new vcSolveContainer(); var _lsControl = new List <object>(); _lsControl.Add(_control); numlet.OutputContainers = _lsControl; numlet.NumletType = G__WorkNumletType.Solve; numlet.IsAnswer = false; _control.MyNumletParent = numlet; _control.MyImmediateParent = numlet; _control.MyWorkSpaceParent = numlet.MyWorkSpaceParent; // Sizing nfloat _xSpacing = this._globalSizeDimensions.NumletNumberSpacing; nfloat _xPos = _xSpacing; nfloat _yPos = (_xSpacing / 2.0f); // Hook up the control resizing events so that all controls are messaged by this numlet numlet.SizeClass.eResizing += _control.SizeClass.OnResize; // Most of these should ApplyUI in ViewWillAppear _control.ApplyUIWhere = G__ApplyUI.ViewWillAppear; _control.SizeClass.SetViewPosition(_xPos, _yPos); // DEATH! //numlet.AddAndDisplayController(_control); // Pad out the end numlet.SizeClass.CurrentWidth = this._globalSizeDimensions.GlobalNumberWidth + (2 * _xSpacing); numlet.SizeClass.CurrentHeight = this._globalSizeDimensions.NumletHeight; // Return completed numnut! // Numlet has no size params set. SetPositions must be called before use! return(numlet); }
public void CreateNumletResult(vcWorkNumlet numlet, string _strResult) { // Create all our expression symbols, numbers etc // REMEMBER: do we add the equals sign here?? Not sure _strResult = ("=," + _strResult); // Build... List <object> UIOutput = this.StringToObjects(_strResult); // Set Parent //numlet.MyWorkSpaceParent = this._vcCurrentWorkSpace; //numlet.MyImmediateParent = this._vcCurrentWorkSpace; numlet.OutputContainers = UIOutput; // Sizing //G__NumberDisplaySize _displaySize; nfloat _xSpacing = this._globalSizeDimensions.NumletNumberSpacing; nfloat _xPos = _xSpacing; for (int i = 0; i < UIOutput.Count; i++) { var _control = (BaseContainer)UIOutput[i]; // Set Parents _control.MyNumletParent = numlet; _control.MyImmediateParent = numlet; _control.MyWorkSpaceParent = numlet.MyWorkSpaceParent; _control.SizeClass.SetCenterRelativeParentViewPosY = true; //_control.CurrentEditMode = this._numberAppSettings.GA__NumberEditMode; // Let the numlet know its the answer if (_control.IsAnswer) { numlet.OutputAnswerContainers.Add(_control); numlet.IsAnswer = true; numlet.IsReadOnly = false; } if (_control.IsFreeFrom) { numlet.IsFreeFrom = true; } // Event Hooks ************************************************************************ // Value and selection changes - FLOW - FROM CONTROL UP TO NUMLET _control.eValueChanged += numlet.OnValueChange; // Hook up the control resizing - FLOW - FROM NUMLET DOWN TO CONTROL numlet.eSizeChanged += _control.OnSizeChange; numlet.SizeClass.eResizing += _control.SizeClass.OnResize; // Most of these should ApplyUI in ViewWillAppear _control.ApplyUIWhere = G__ApplyUI.ViewWillAppear; _control.SizeClass.SetViewPosition(_xPos, this._globalSizeDimensions.NumletHeight); //numlet.AddAndDisplayController(_control); _xPos = _xPos + _control.SizeClass.CurrentWidth + _xSpacing; } // Event Hooks ************************************************************************ // Value and selection changes - FLOW - FROM NUMLET UP TO WORKSPACE numlet.eValueChanged += numlet.MyWorkSpaceParent.OnValueChange; // Resizing - FLOW - FROM WORKSPACE DOWN TO NUMLET numlet.MyWorkSpaceParent.eSizeChanged += numlet.OnSizeChange; numlet.MyWorkSpaceParent.SizeClass.eResizing += numlet.SizeClass.OnResize; // Pad out the end numlet.SizeClass.CurrentWidth = _xPos; numlet.SizeClass.CurrentHeight = this._globalSizeDimensions.NumletHeight; // Return completed numnut! // Numlet has no size params set. SetPositions must be called before use! // return numlet; }
public void CreateNumletEquation(vcWorkNumlet numlet, string _strEquation) { List <object> UIOutput = this.StringToObjects(_strEquation); // Create all our expression symbols, numbers etc //this.StringToObjects(_strEquation); //// Set Parent //numlet.MyWorkSpaceParent = this._vcCurrentWorkSpace; //numlet.MyImmediateParent = this._vcCurrentWorkSpace; numlet.OutputContainers = UIOutput; // Sizing //G__NumberDisplaySize _displaySize; nfloat _xSpacing = this._globalSizeDimensions.NumletNumberSpacing; nfloat _xPos = _xSpacing; for (int i = 0; i < UIOutput.Count; i++) { var _control = (BaseContainer)UIOutput[i]; // Set Parents _control.MyNumletParent = numlet; _control.MyImmediateParent = numlet; _control.MyWorkSpaceParent = numlet.MyWorkSpaceParent; // Let the numlet know its the answer if (_control.IsAnswer) { numlet.OutputAnswerContainers.Add(_control); numlet.IsAnswer = true; numlet.IsReadOnly = false; } if (_control.IsFreeFrom) { numlet.IsFreeFrom = true; } _control.SizeClass.SetCenterRelativeParentViewPosY = true; // Event Hooks ************************************************************************ // Value and selection changes - FLOW - FROM CONTROL UP TO NUMLET _control.eValueChanged += numlet.OnValueChange; // Hook up the control resizing - FLOW - FROM NUMLET DOWN TO CONTROL numlet.eSizeChanged += _control.OnSizeChange; numlet.SizeClass.eResizing += _control.SizeClass.OnResize; // Most of these should ApplyUI in ViewWillAppear _control.ApplyUIWhere = G__ApplyUI.ViewWillAppear; _control.SizeClass.SetViewPosition(_xPos, this._globalSizeDimensions.NumletHeight); // DEATH! // This is the cause of the problem. The NUMLET! hasnt been added to the view heirachy... //numlet.AddAndDisplayController(_control); // OK here.. what do we do? // Do I keep the this._uiOutputEquation object as it technically has all the controls // And the sizing done. // OR // Do I create a new List<object> of the newly changed objects. IM thinking th later _xPos = _xPos + _control.SizeClass.CurrentWidth + _xSpacing; } // Event Hooks ************************************************************************ // Value and selection changes - FLOW - FROM NUMLET UP TO WORKSPACE numlet.eValueChanged += numlet.MyWorkSpaceParent.OnValueChange; // Resizing - FLOW - FROM WORKSPACE DOWN TO NUMLET numlet.MyWorkSpaceParent.eSizeChanged += numlet.OnSizeChange; numlet.MyWorkSpaceParent.SizeClass.eResizing += numlet.SizeClass.OnResize; // Pad out the end numlet.SizeClass.CurrentWidth = _xPos; numlet.SizeClass.CurrentHeight = this._globalSizeDimensions.NumletHeight; // Shouldnt need to return anything, this will be fired form Numlet // Return completed numnut! // Numlet has no size params set. SetPositions must be called before use! //return numlet; }