public void RebuildToolGrid() { SourceGrid3.Grid toolGrid = project().Window().ToolGrid(); // recursive protection if (rebuildingGrid) { return; } rebuildingGrid = true; for (int row = 0; row < toolGrid.RowsCount; row++) { for (int col = 0; col < toolGrid.ColumnsCount; col++) { toolGrid[row, col] = null; } } ObjectRegistry.Sort(); int currentTestSequenceStartingColumn = 0; int nextTestSequenceStartingColumn = 0; TestSequence lastTestSequence = null; foreach (IObjectDefinition ob in ObjectRegistry.ObjectList()) { if (ob.ToolMapRow >= 0 && ob.IncludeObjectInProgrammingTable()) // ignore objects with row < 0 (e.g. Parameter objects which are just connectors) { /* removed 7/3/08 since fixed ConstantValueDefinition support for IncludeObjectInProgrammingTable() * if (ob is ConstantValueDefinition) * { * if (ob.Name == "" + ((ConstantValueDefinition)ob).Value) * { * continue; // don't bother including unnamed constant values * } * } */ if (ob.TestSequence() != lastTestSequence) // NOTE: as currently implemented there is only 1 test sequence in each objectSpace...I think maybe I was originally thinking of having the object space at the project level...for object sharing?? { currentTestSequenceStartingColumn = nextTestSequenceStartingColumn; lastTestSequence = ob.TestSequence(); } ob.ToolMapColumn = currentTestSequenceStartingColumn; // note: you won't get what you ask for if it is already taken toolGrid[ob.ToolMapRow, ob.ToolMapColumn] = new SourceGrid3.Cells.Real.Cell(ob); toolGrid[ob.ToolMapRow, ob.ToolMapColumn].AddController(project().Window().clickController); if (ob == Window().SelectedObject()) { toolGrid[ob.ToolMapRow, ob.ToolMapColumn].Select = true; } nextTestSequenceStartingColumn = Math.Max(nextTestSequenceStartingColumn, ob.ToolMapColumn + 1); } } toolGrid.AutoSize(); rebuildingGrid = false; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.grid = new SourceGrid3.Grid(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.trackBarInterval = new System.Windows.Forms.TrackBar(); ((System.ComponentModel.ISupportInitialize)(this.trackBarInterval)).BeginInit(); this.SuspendLayout(); // // grid // this.grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.grid.AutoSizeMinHeight = 10; this.grid.AutoSizeMinWidth = 10; this.grid.AutoStretchColumnsToFitWidth = false; this.grid.AutoStretchRowsToFitHeight = false; this.grid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.grid.CustomSort = false; this.grid.GridToolTipActive = true; this.grid.Location = new System.Drawing.Point(4, 56); this.grid.Name = "grid"; this.grid.OverrideCommonCmdKey = true; this.grid.Size = new System.Drawing.Size(284, 204); this.grid.SpecialKeys = SourceGrid3.GridSpecialKeys.Default; this.grid.StyleGrid = null; this.grid.TabIndex = 0; // // label1 // this.label1.Location = new System.Drawing.Point(4, 4); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(108, 28); this.label1.TabIndex = 2; this.label1.Text = "Interval (Millisecond 500 - 5000)"; // // label2 // this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label2.Location = new System.Drawing.Point(4, 36); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(280, 16); this.label2.TabIndex = 3; this.label2.Text = "Processes"; this.label2.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // trackBarInterval // this.trackBarInterval.AutoSize = false; this.trackBarInterval.Location = new System.Drawing.Point(116, 4); this.trackBarInterval.Minimum = 1; this.trackBarInterval.Name = "trackBarInterval"; this.trackBarInterval.Size = new System.Drawing.Size(168, 20); this.trackBarInterval.TabIndex = 4; this.trackBarInterval.Value = 1; this.trackBarInterval.Scroll += new System.EventHandler(this.trackBarInterval_Scroll); // // frmSample23 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.trackBarInterval); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.grid); this.Name = "frmSample23"; this.Text = "Real Time Data Refresh"; ((System.ComponentModel.ISupportInitialize)(this.trackBarInterval)).EndInit(); this.ResumeLayout(false); }