private void RelatedCompoundsDialog_Shown(object sender, EventArgs e) { if (CurrentCidCheckEdit.Checked) { CidCtl.Focus(); } }
private void InputCompoundId_Activated(object sender, EventArgs e) { Timer1.Enabled = true; CidCtl.Focus(); }
/// <summary> /// Validate the form and build and validate the query /// </summary> /// <returns></returns> bool ValidateFormAndBuildQuery() { try { // Retrieve data for a single Cid if (CurrentCidCheckEdit.Checked) { string cid = CidCtl.Text; cid = CompoundId.Normalize(cid); if (Lex.IsUndefined(cid) || !CompoundIdUtil.Exists(cid)) { throw new Exception("Invalid or non-existant :" + RootTable.KeyMetaColumn.Label + ": " + CidCtl.Text); } } // Retrieve data for related structures else if (RelatedStrsCheckEdit.Checked) { if (AltForms.Checked || MatchedPairs.Checked || SmallWorld.Checked || SimilarSearch.Checked || Substructure.Checked) { ; } else { throw new Exception("At least one type of structure search must be specified to find structurally-related compounds"); } } // Retrieve for marked Cids else if (MarkedCidsCheckEdit.Checked) { // OK } // Retrieve for all Cids in originating query else if (AllCidsCheckEdit.Checked) { // OK } else { throw new Exception("A compound retrieval type must be specified"); } int mi = MruListCtl.SelectedIndex; if (mi < 0 || mi >= MruListCtl.ItemCount) { throw new Exception("You must select a query or data table to use to retrieve related data"); } UpdateSelectedNodesSet(); Query q = BuildQuery(); MqlUtil.CheckTableCompatibility(q); RelatedCompoundsQuery = q; return(true); } catch (Exception ex) { MessageBoxMx.ShowError(ex.Message); CidCtl.Focus(); return(false); } }