public void MoveItem(int idx, int newIdx) { if ((newIdx >= itemCou) || (idx >= itemCou)) { return; } if (LoseJoinsStabilityOnMove(idx, newIdx)) { MessageBox.Show("Affected table(s) depend on moved item, operation cancelled "); return; } JoinCtrl o = items[idx]; if (idx > newIdx) { items[idx - 1].JoinTo(items[idx].data.leftTable); for (int i = idx; i > newIdx; i--) { items[i] = items[i - 1]; } } else { items[idx + 1].JoinTo(items[idx].data.leftTable); for (int i = idx; i < newIdx; i++) { items[i] = items[i + 1]; } } items[newIdx] = o; if (newIdx > 0) { items[newIdx].JoinTo(items[newIdx - 1].data.rightTable); items[0].JoinTo(""); } else { items[newIdx].JoinTo(""); } HeighFit(); this.ScrollControlIntoView(o); }
public void AddItem(join j) { JoinCtrl itm = new JoinCtrl(j); // / itm.data = j; itm.tabInfo = Box.GetTableByName(j.rightTable); // itm.SizeUp(this.Width-15); itm.Width = this.Width - 15; itm.BackColor = ((itemCou % 2) == 0) ? Color.AliceBlue : Color.FloralWhite; itm.BackColorDef = itm.BackColor; // itm.Height; // itm.Width = this.Width-15; // itm.Location = new Point(3, (itemCou > 0)? items[itemCou -1].Bounds.Bottom +2 : 2); itm.Location = new Point(3, (itemCou > 0)? GetTotalItemsHeigh(0, itemCou) : 2); items[itemCou] = itm; itemCou++; Controls.Add(itm); }
void OuterKeyzMouseDoubleClick(object sender, MouseEventArgs e) { JoinCtrl sel = ((QueryJoinsCtrl)Parent).selectedItem; if ((isFocused || (sel == null))) { if (dat.leftTable.Trim() != "") { if (CheckSelCondOpr1Fill()) { AddEmptyTypedCondition(ConditionType.equality); SizeUp(); minimized = true; ShrinkCtrlClick(null, null); if (!isFocused) { SetFocusinList(); } } } } else { if (sel != null) { if (sel.ListIdx > this.ListIdx) { sel.InsertOutField(GetSelFieldFullPath()); } else { SetFocusinList(); // MessageBox.Show("It is not allowed by the RULES \n You must move down joined table (so it will COME AFTER the table join to)"); } } } }