protected virtual void SetInfoBarText() { if (m_informationBar == null) { return; } string className = StringTbl.GetString("No Records", "Misc"); if (Clerk.CurrentObject != null) { string typeName = Clerk.CurrentObject.GetType().Name; if (Clerk.CurrentObject is CmPossibility) { CmPossibility possibility = Clerk.CurrentObject as CmPossibility; className = possibility.ItemTypeName(StringTbl); } else { className = StringTbl.GetString(typeName, "ClassNames"); } if (className == "*" + typeName + "*") { className = typeName; } } // This code: ((IPaneBar)m_informationBar).Text = className; // causes about 47 of the following exceptions when executed in Flex. // First-chance exception at 0x4ed9b280 in Flex.exe: 0xC0000005: Access violation writing location 0x00f90004. // The following code doesn't cause the exception, but neither one actually sets the Text to className, // so something needs to be changed somewhere. It doesn't enter "override string Text" in PaneBar.cs (m_informationBar as IPaneBar).Text = className; }
protected void PopulateCombo(XmlNode parameters) { Debug.Assert(StringTbl != null, "A StringTable must be provided for the enum combo slice."); m_combo.Items.Clear(); XmlNode node = parameters.SelectSingleNode("stringList"); if (node == null) { throw new ApplicationException("The Enum editor requires a <stringList> element in the <deParams>"); } string[] labels = StringTbl.GetStringsFromStringListNode(node); int width = 0; using (Graphics g = m_combo.CreateGraphics()) { foreach (string label in labels) { SizeF size = g.MeasureString(label, m_combo.Font); if (size.Width > width) { width = (int)Math.Ceiling(size.Width); } m_combo.Items.Add(label); } } m_comboWidth = width + 25; m_combo.Width = m_comboWidth; m_combo.MaxDropDownItems = Math.Min(m_combo.Items.Count, 20); }
protected string GetBaseTitleStringFromConfig() { string titleStr = ""; // See if we have an AlternativeTitle string table id for an alternate title. string titleId = XmlUtils.GetAttributeValue(m_configurationParameters, "altTitleId"); if (titleId != null) { titleStr = StringTbl.GetString(titleId, "AlternativeTitles"); if (Clerk.OwningObject != null && XmlUtils.GetBooleanAttributeValue(m_configurationParameters, "ShowOwnerShortname")) { // Originally this option was added to enable the Reversal Index title bar to show // which reversal index was being shown. titleStr = string.Format(xWorksStrings.ksXReversalIndex, Clerk.OwningObject.ShortName, titleStr); } } else if (Clerk.OwningObject != null) { if (XmlUtils.GetBooleanAttributeValue(m_configurationParameters, "ShowOwnerShortname")) { titleStr = Clerk.OwningObject.ShortName; } } return(titleStr); }
protected override void SetInfoBarText() { if (m_informationBar == null) { return; } string titleStr = ""; // See if we have an AlternativeTitle string table id for an alternate title. string titleId = XmlUtils.GetAttributeValue(m_configurationParameters, "altTitleId"); if (titleId != null) { titleStr = StringTbl.GetString(titleId, "AlternativeTitles"); } else if (Clerk.OwningObject != null) { if (XmlUtils.GetBooleanAttributeValue(m_configurationParameters, "ShowOwnerShortname")) { titleStr = Clerk.OwningObject.ShortName; } } bool fBaseCalled = false; if (titleStr == string.Empty) { base.SetInfoBarText(); fBaseCalled = true; // titleStr = ((IPaneBar)m_informationBar).Text; // can't get to work. // (EricP) For some reason I can't provide an IPaneBar get-accessor to return // the new Text value. If it's desirable to allow TitleFormat to apply to // Clerk.CurrentObject, then we either have to duplicate what the // base.SetInfoBarText() does here, or get the string set by the base. // for now, let's just return. if (titleStr == null || titleStr == string.Empty) { return; } } // If we have a format attribute, format the title accordingly. string sFmt = XmlUtils.GetAttributeValue(m_configurationParameters, "TitleFormat"); if (sFmt != null) { titleStr = String.Format(sFmt, titleStr); } // if we haven't already set the text through the base, // or if we had some formatting to do, then set the infoBar text. if (!fBaseCalled || sFmt != null) { ((IPaneBar)m_informationBar).Text = titleStr; } }
/// <summary> /// decide whether to enable this tree delete Menu Item /// </summary> /// <param name="commandObject"></param> /// <param name="display"></param> /// <returns></returns> public override bool OnDisplayDataTreeMerge(object commandObject, ref UIItemDisplayProperties display) { display.Enabled = CanMergeOrMove; if (!display.Enabled) { display.Text += StringTbl.GetString("(cannot merge this)"); } return(true); //we handled this, no need to ask anyone else. }
protected virtual void SetInfoBarText() { if (m_informationBar == null) { return; } string className = StringTbl.GetString("No Record", "Misc"); if (Clerk.CurrentObject != null) { string typeName = Clerk.CurrentObject.GetType().Name; if (Clerk.CurrentObject is ICmPossibility) { var possibility = Clerk.CurrentObject as ICmPossibility; className = possibility.ItemTypeName(StringTbl); } else { className = StringTbl.GetString(typeName, "ClassNames"); } if (className == "*" + typeName + "*") { className = typeName; } } else { string emptyTitleId = XmlUtils.GetAttributeValue(m_configurationParameters, "emptyTitleId"); if (!String.IsNullOrEmpty(emptyTitleId)) { string titleStr; XmlViewsUtils.TryFindString(StringTbl, "EmptyTitles", emptyTitleId, out titleStr); if (titleStr != "*" + emptyTitleId + "*") { className = titleStr; } Clerk.UpdateStatusBarRecordNumber(titleStr); } } // This code: ((IPaneBar)m_informationBar).Text = className; // causes about 47 of the following exceptions when executed in Flex. // First-chance exception at 0x4ed9b280 in Flex.exe: 0xC0000005: Access violation writing location 0x00f90004. // The following code doesn't cause the exception, but neither one actually sets the Text to className, // so something needs to be changed somewhere. It doesn't enter "override string Text" in PaneBar.cs (m_informationBar as IPaneBar).Text = className; }
/// <summary> /// Read in the parameters to determine which collection we are editing. /// </summary> protected override void ReadParameters() { base.ReadParameters(); m_layoutName = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "layout"); m_layoutChoiceField = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "layoutChoiceField"); m_titleField = XmlUtils.GetAttributeValue(m_configurationParameters, "titleField"); if (!string.IsNullOrEmpty(m_titleField)) { Cache.DomainDataByFlid.AddNotification(this); } string titleId = XmlUtils.GetAttributeValue(m_configurationParameters, "altTitleId"); if (titleId != null) { m_titleStr = StringTbl.GetString(titleId, "AlternativeTitles"); } m_printLayout = XmlUtils.GetAttributeValue(m_configurationParameters, "printLayout"); }
public virtual bool OnDisplayMoveReversalPOS(object commandObject, ref UIItemDisplayProperties display) { Slice slice = m_dataEntryForm.CurrentSlice; if (slice == null || slice.Object == null) { display.Enabled = false; } else { display.Enabled = CanMergeOrMove; display.Visible = InFriendlyArea; } if (!display.Enabled) { display.Text += StringTbl.GetString("(cannot move this)"); } return(true); //we've handled this }
/// ------------------------------------------------------------------------------------ /// <summary> /// Inits the specified mediator. /// </summary> /// <param name="mediator">The mediator.</param> /// <param name="configurationParameters">The configuration parameters.</param> /// ------------------------------------------------------------------------------------ public override void Init(XCore.Mediator mediator, System.Xml.XmlNode configurationParameters) { base.Init(mediator, configurationParameters); // Load the special strings from the string table if possible. If not, use the // default (English) values. if (mediator != null && mediator.HasStringTable) { StringTbl = mediator.StringTbl; if (StringTbl != null) { m_sNullItemLabel = StringTbl.GetString("NullItemLabel", "DetailControls/ReferenceComboBox"); } } if (string.IsNullOrEmpty(m_sNullItemLabel) || m_sNullItemLabel == "*NullItemLabel*") { m_sNullItemLabel = DetailControlsStrings.ksNullLabel; } }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> public ReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider, Mediator mediator) : base(new UserControl(), cache, obj, flid) { m_mediator = mediator; m_persistProvider = persistenceProvider; m_combo = new FwComboBox(); m_combo.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_combo.DropDownStyle = ComboBoxStyle.DropDownList; m_combo.Font = new System.Drawing.Font( cache.LangProject.DefaultVernacularWritingSystemFont, 10); if (!Application.RenderWithVisualStyles) { m_combo.HasBorder = false; } m_combo.Dock = DockStyle.Left; m_combo.Width = 200; Control.Height = m_combo.Height; // Combo has sensible default height, UserControl does not. Control.Controls.Add(m_combo); m_combo.SelectedIndexChanged += new EventHandler(SelectionChanged); // Load the special strings from the string table if possible. If not, use the // default (English) values. if (mediator != null && mediator.HasStringTable) { StringTbl = mediator.StringTbl; if (StringTbl != null) { m_sNullItemLabel = StringTbl.GetString("NullItemLabel", "DetailControls/ReferenceComboBox"); } } if (m_sNullItemLabel == null || m_sNullItemLabel == "" || m_sNullItemLabel == "*NullItemLabel*") { m_sNullItemLabel = DetailControlsStrings.ksNullLabel; } }
protected override void SetInfoBarText() { if (m_informationBar == null) { return; } // See if we have an AlternativeTitle string table id for an alternate title. string titleId = XmlUtils.GetAttributeValue(m_configurationParameters, "altTitleId"); if (titleId != null) { string titleStr = StringTbl.GetString(titleId, "AlternativeTitles"); if (titleStr != null && titleStr != String.Empty) { ((IPaneBar)m_informationBar).Text = titleStr; return; } } base.SetInfoBarText(); }