// Column formatting button & menu clicks internal void FormattingButton_Click(object sender, EventArgs e) { GridCell[] cells; int topRow, bottomRow; GridColumn leftCol, rightCol; if (MoleculeGrid.BGV == null) { return; } QueryColumn qc = null; MoleculeGrid.GetSelectedCells(out cells, out topRow, out bottomRow, out leftCol, out rightCol); if (leftCol != null) { ColumnInfo cInf = MoleculeGrid.GetColumnInfo(leftCol); if (cInf != null) { qc = cInf.Qc; } } QueryTableControl.SetupColumnFormattingContextMenu(FieldFormattingContextMenu, qc, MoleculeGrid.Helpers.UseNamedCfMenuItem_Click); SimpleButton b = sender as SimpleButton; FieldFormattingContextMenu.Show(b, new System.Drawing.Point(0, b.Height)); }
/// <summary> /// SetFieldGridDataRow /// </summary> /// <param name="dr"></param> /// <param name="f"></param> void SetFieldGridDataRow(DataRow dr, PivotGridFieldMx f) { string label, txt; ResultsField rfld = f.ResultsField as ResultsField; ResultsTable rt = rfld.ResultsTable; ResultsFormat rf = rt.ResultsFormat; MetaColumn mc = rfld.MetaColumn; QueryColumn qc = rfld.QueryColumn; QueryTable qt = qc.QueryTable; Query q = qt.Query; dr["ColTypeImageCol"] = QueryTableControl.GetMetaColumnDataTypeImage(mc); dr["PivotFieldCol"] = f; // store reference to pivot field dr["FieldNameCol"] = f.Caption; dr["AggRoleCol"] = f.Aggregation.RoleLabel; dr["AggTypeCol"] = f.Aggregation.TypeLabel; // txt = GroupingTypeLabel(f); // dr["HeaderBinningCol"] = txt; dr["SourceColumnCol"] = PivotGridControlMx.BuildFieldCaption(f); label = qt.ActiveLabel; if (rf.Tables.Count > 1) { label = "T" + (rt.Position + 1) + " - " + label; } dr["SourceTableCol"] = label; return; }
/// <summary> /// Respond to click on criteria tab table label /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CtTableLabel_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { LabelControl label = (LabelControl)sender; QueryTable qt = label.Tag as QueryTable; if (qt == null) { return; } QueryTableControl.ShowTableLabelDropdown(qt, label); return; }
private void gridView1_MouseDown(object sender, MouseEventArgs e) { Point p; int ri, ci; GridHitInfo ghi = GridView.CalcHitInfo(e.Location); if (ghi.Column.AbsoluteIndex != 1) { return; } ri = ghi.RowHandle; QueryTable qt = Query.Tables[ri]; ContextMenuStrip colPopup = new ContextMenuStrip(); bool firstLabel = true; foreach (QueryColumn qc in qt.QueryColumns) { // get list of allowed field labels/names for each table if (!QueryTableControl.QueryColumnVisible(qc) || !qc.MetaColumn.IsSearchable) { continue; } if (firstLabel) { firstLabel = false; } string label = CriteriaEditor.GetUniqueColumnLabel(qc); ToolStripMenuItem mi = new ToolStripMenuItem(label, null, new System.EventHandler(SelectedField_Click)); mi.Tag = "T" + (ri + 1); colPopup.Items.Add(mi); } p = e.Location; GridViewInfo viewInfo = (GridViewInfo)GridView.GetViewInfo(); GridCellInfo cellInfo = viewInfo.GetGridCellInfo(ghi.RowHandle, ghi.Column); if (cellInfo != null) { p = new Point(cellInfo.Bounds.Left, cellInfo.Bounds.Bottom); } colPopup.Show(Instance.TableGrid, p); }
/// <summary> /// Add a structure criteria item to the criteria tab /// </summary> /// <param name="text"></param> /// <param name="tag"></param> void AddCriteriaTabStructureItem( QueryColumn qc) { LabelControl label = AddColumnLabel(qc.ActiveLabel); int structBoxX = 142; if (label.Left + label.Width > structBoxX) // shift textbox as needed { structBoxX = label.Left + label.Width + 4; } else { label.Text += " . . . . . . . . . . . ."; } // Build the structure control PictureEdit structBox = new DevExpress.XtraEditors.PictureEdit(); structBox.Location = new System.Drawing.Point(142, CriteriaTabYPos + 6); structBox.Name = "CtStructBox"; structBox.Size = new System.Drawing.Size(200, 136); structBox.Tag = qc.QueryTable.MetaTable.Name + "." + qc.MetaColumn.Name; structBox.Properties.ContextMenuStrip = this.CriteriaTabRtClickContextMenu; int pixWidth = structBox.Width; Font font = structBox.Font; Bitmap bm = QueryTableControl.GetQueryMoleculeBitmap(qc, pixWidth, font); int height = bm.Height; if (height < 20) { height = 20; } structBox.Height = height; structBox.Image = bm; structBox.MouseDown += new System.Windows.Forms.MouseEventHandler(CtStructBox_MouseDown); ScrollablePanel.Controls.Add(structBox); ScrollablePanel.Controls.Add(label); CtStructBox = structBox; // so references to CtStructBox refer to new box CriteriaTabYPos += structBox.Height + 4; return; }