Fix problem with Item Selected. Fixes problem so that Item selected stays selected even if it is not active.
Also, makes DSOFramer properly select the related tab when it becomes active.
This commit is contained in:
parent
f6bb58d4d4
commit
ee9acb929d
@ -16,6 +16,7 @@ namespace Volian.Controls.Library
|
|||||||
private DisplayTabControl _MyTabControl;
|
private DisplayTabControl _MyTabControl;
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private AxDSOFramer.AxFramerControl _MyDSOFramer;
|
private AxDSOFramer.AxFramerControl _MyDSOFramer;
|
||||||
|
private TransPanel _MyTransPanel;
|
||||||
private static int _Count = 0;
|
private static int _Count = 0;
|
||||||
private DocumentInfo _MyDocument;
|
private DocumentInfo _MyDocument;
|
||||||
private int _MyCount;
|
private int _MyCount;
|
||||||
@ -67,10 +68,21 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
_Count++;
|
_Count++;
|
||||||
_MyCount = _Count;
|
_MyCount = _Count;
|
||||||
|
this._MyTransPanel = new TransPanel();
|
||||||
this._MyDSOFramer = new AxDSOFramer.AxFramerControl();
|
this._MyDSOFramer = new AxDSOFramer.AxFramerControl();
|
||||||
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit();
|
||||||
this.Controls.Add(this._MyDSOFramer);
|
this.Controls.Add(this._MyDSOFramer);
|
||||||
|
this.Controls.Add(this._MyTransPanel);
|
||||||
this.components.Add(this._MyDSOFramer);
|
this.components.Add(this._MyDSOFramer);
|
||||||
|
this.components.Add(this._MyTransPanel);
|
||||||
|
this._MyTransPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this._MyTransPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this._MyTransPanel.ForeColor = System.Drawing.Color.Brown;
|
||||||
|
//this._MyTransPanel.Location = new System.Drawing.Point(0, 0);
|
||||||
|
//this._MyTransPanel.Name = "transPanel1";
|
||||||
|
//this._MyTransPanel.Size = new System.Drawing.Size(370, 423);
|
||||||
|
//this._MyTransPanel.TabIndex = 1;
|
||||||
|
this._MyTransPanel.Click += new EventHandler(_MyTransPanel_Click);
|
||||||
this._MyDSOFramer.Dock = System.Windows.Forms.DockStyle.Fill;
|
this._MyDSOFramer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
|
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
|
||||||
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
|
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
|
||||||
@ -82,7 +94,17 @@ namespace Volian.Controls.Library
|
|||||||
// this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
|
// this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
|
||||||
this._MyDSOFramer.BeforeDocumentClosed += new AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEventHandler(_MyDSOFramer_BeforeDocumentClosed);
|
this._MyDSOFramer.BeforeDocumentClosed += new AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEventHandler(_MyDSOFramer_BeforeDocumentClosed);
|
||||||
this._MyDSOFramer.OnSaveCompleted += new AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEventHandler(_MyDSOFramer_OnSaveCompleted);
|
this._MyDSOFramer.OnSaveCompleted += new AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEventHandler(_MyDSOFramer_OnSaveCompleted);
|
||||||
|
//this._MyDSOFramer.OnActivationChange += new AxDSOFramer._DFramerCtlEvents_OnActivationChangeEventHandler(_MyDSOFramer_OnActivationChange);
|
||||||
this.Enter += new EventHandler(DSOTabPanel_Enter);
|
this.Enter += new EventHandler(DSOTabPanel_Enter);
|
||||||
|
this.Leave += new EventHandler(DSOTabPanel_Leave);
|
||||||
|
}
|
||||||
|
void DSOTabPanel_Leave(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_MyTransPanel.BringToFront();
|
||||||
|
}
|
||||||
|
void _MyTransPanel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Select();
|
||||||
}
|
}
|
||||||
void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
|
void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
|
||||||
{
|
{
|
||||||
@ -101,6 +123,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
void DSOTabPanel_Enter(object sender, EventArgs e)
|
void DSOTabPanel_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
_MyTransPanel.SendToBack();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_MyDSOFramer.EventsEnabled = true;
|
_MyDSOFramer.EventsEnabled = true;
|
||||||
|
@ -433,8 +433,8 @@ namespace Volian.Controls.Library
|
|||||||
this.BackColorChanged += new EventHandler(vlnCSLARTB_BackColorChanged);
|
this.BackColorChanged += new EventHandler(vlnCSLARTB_BackColorChanged);
|
||||||
//_DisplayRTB.Enter += new EventHandler(_DisplayRTB_Enter);
|
//_DisplayRTB.Enter += new EventHandler(_DisplayRTB_Enter);
|
||||||
//_DisplayRTB.Leave += new EventHandler(_DisplayRTB_Leave);
|
//_DisplayRTB.Leave += new EventHandler(_DisplayRTB_Leave);
|
||||||
_DisplayRTB.GotFocus += new EventHandler(_DisplayRTB_GotFocus);
|
//_DisplayRTB.GotFocus += new EventHandler(_DisplayRTB_GotFocus);
|
||||||
_DisplayRTB.LostFocus += new EventHandler(_DisplayRTB_LostFocus);
|
//_DisplayRTB.LostFocus += new EventHandler(_DisplayRTB_LostFocus);
|
||||||
_DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick);
|
_DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
@ -541,16 +541,16 @@ namespace Volian.Controls.Library
|
|||||||
// _Panel._ItemSelected = _MyItem;
|
// _Panel._ItemSelected = _MyItem;
|
||||||
// _Panel.OnItemSelectedChanged(sender, new DisplayPanelEventArgs(this, null));
|
// _Panel.OnItemSelectedChanged(sender, new DisplayPanelEventArgs(this, null));
|
||||||
//}
|
//}
|
||||||
void _DisplayRTB_LostFocus(object sender, EventArgs e)
|
//void _DisplayRTB_LostFocus(object sender, EventArgs e)
|
||||||
{
|
//{
|
||||||
_Panel._ItemSelected = null;
|
// //_Panel.ItemSelected = null;
|
||||||
_Panel.OnItemSelectedChanged(sender, null);
|
// //_Panel.OnItemSelectedChanged(sender, null);
|
||||||
}
|
//}
|
||||||
void _DisplayRTB_GotFocus(object sender, EventArgs e)
|
//void _DisplayRTB_GotFocus(object sender, EventArgs e)
|
||||||
{
|
//{
|
||||||
_Panel._ItemSelected = _MyItem;
|
// _Panel.ItemSelected = _MyItem;
|
||||||
_Panel.OnItemSelectedChanged(sender, new DisplayPanelEventArgs(this, null));
|
// //_Panel.OnItemSelectedChanged(sender, new DisplayPanelEventArgs(this, null));
|
||||||
}
|
//}
|
||||||
//void _DisplayRTB_Leave(object sender, EventArgs e)
|
//void _DisplayRTB_Leave(object sender, EventArgs e)
|
||||||
//{
|
//{
|
||||||
// _Panel._ItemSelected = null;
|
// _Panel._ItemSelected = null;
|
||||||
@ -938,7 +938,7 @@ namespace Volian.Controls.Library
|
|||||||
_Moving = false;
|
_Moving = false;
|
||||||
BottomMost.AdjustLocation();
|
BottomMost.AdjustLocation();
|
||||||
}
|
}
|
||||||
void _DisplayRTB_LinkGoTo(object sender, System.Windows.Forms.LinkClickedEventArgs e)
|
private void _DisplayRTB_LinkGoTo(object sender, System.Windows.Forms.LinkClickedEventArgs e)
|
||||||
{
|
{
|
||||||
_MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + e.LinkText);
|
_MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + e.LinkText);
|
||||||
_Panel.OnLinkClicked(sender, new DisplayLinkEventArgs(this, e));
|
_Panel.OnLinkClicked(sender, new DisplayLinkEventArgs(this, e));
|
||||||
@ -947,14 +947,15 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
_Panel.OnItemClick(this, new DisplayPanelEventArgs(this, e));
|
_Panel.OnItemClick(this, new DisplayPanelEventArgs(this, e));
|
||||||
}
|
}
|
||||||
private void veRichTextBoxText_Enter(object sender, EventArgs e)
|
private void _DisplayRTB_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_DisplayRTB.BackColor = _Panel.ActiveColor;
|
_Panel.DisplayRTB = _DisplayRTB;
|
||||||
}
|
_Panel.ItemSelected = _MyItem;
|
||||||
private void veRichTextBoxText_Leave(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_DisplayRTB.BackColor = _Panel.InactiveColor;
|
|
||||||
}
|
}
|
||||||
|
//private void veRichTextBoxText_Leave(object sender, EventArgs e)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
private void _DisplayRTB_LinkModifyTran(object sender, LinkClickedEventArgs e)
|
private void _DisplayRTB_LinkModifyTran(object sender, LinkClickedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -61,9 +61,8 @@ namespace Volian.Controls.Library
|
|||||||
this._DisplayRTB.TabIndex = 2;
|
this._DisplayRTB.TabIndex = 2;
|
||||||
this._DisplayRTB.Text = "";
|
this._DisplayRTB.Text = "";
|
||||||
this._DisplayRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.Edit;
|
this._DisplayRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.Edit;
|
||||||
this._DisplayRTB.Enter += new System.EventHandler(this.veRichTextBoxText_Enter);
|
this._DisplayRTB.Enter += new System.EventHandler(this._DisplayRTB_Enter);
|
||||||
this._DisplayRTB.LinkGoTo += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkGoTo);
|
this._DisplayRTB.LinkGoTo += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkGoTo);
|
||||||
this._DisplayRTB.Leave += new System.EventHandler(this.veRichTextBoxText_Leave);
|
|
||||||
this._DisplayRTB.HeightChanged += new Volian.Controls.Library.DisplayRTBEvent(this.veRichTextBoxText_HeightChanged);
|
this._DisplayRTB.HeightChanged += new Volian.Controls.Library.DisplayRTBEvent(this.veRichTextBoxText_HeightChanged);
|
||||||
this._DisplayRTB.LinkModifyTran += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkModifyTran);
|
this._DisplayRTB.LinkModifyTran += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkModifyTran);
|
||||||
//
|
//
|
||||||
|
@ -156,11 +156,28 @@ namespace Volian.Controls.Library
|
|||||||
ExpandAsNeeded(item);
|
ExpandAsNeeded(item);
|
||||||
ItemLookup[id].ItemSelect();
|
ItemLookup[id].ItemSelect();
|
||||||
}
|
}
|
||||||
private ItemInfo _LastItemSelected;
|
private DisplayRTB _DisplayRTB = null;
|
||||||
internal ItemInfo LastItemSelected
|
public DisplayRTB DisplayRTB
|
||||||
{
|
{
|
||||||
get { return _LastItemSelected; }
|
get { return _DisplayRTB; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_DisplayRTB == value) return; // Same - No Change
|
||||||
|
if (_DisplayRTB != null)
|
||||||
|
{
|
||||||
|
_DisplayRTB.BackColor = InactiveColor;
|
||||||
|
_DisplayRTB.SaveText(); // Save any changes to the text
|
||||||
}
|
}
|
||||||
|
_DisplayRTB = value;
|
||||||
|
_DisplayRTB.BackColor = ActiveColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//private ItemInfo _LastItemSelected;
|
||||||
|
//internal ItemInfo LastItemSelected
|
||||||
|
//{
|
||||||
|
// get { return _LastItemSelected; }
|
||||||
|
//}
|
||||||
internal ItemInfo _ItemSelected;
|
internal ItemInfo _ItemSelected;
|
||||||
public ItemInfo ItemSelected
|
public ItemInfo ItemSelected
|
||||||
{
|
{
|
||||||
@ -168,12 +185,12 @@ namespace Volian.Controls.Library
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_ItemSelected = value;
|
_ItemSelected = value;
|
||||||
if (value == null)
|
//if (value == null)
|
||||||
{
|
//{
|
||||||
OnItemSelectedChanged(this, null);
|
// OnItemSelectedChanged(this, null);
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
_LastItemSelected = value;
|
//_LastItemSelected = value;
|
||||||
int id = value.ItemID;
|
int id = value.ItemID;
|
||||||
ExpandAsNeeded(value);
|
ExpandAsNeeded(value);
|
||||||
ItemLookup[id].ItemSelect();
|
ItemLookup[id].ItemSelect();
|
||||||
@ -186,8 +203,8 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
public void ItemShow()
|
public void ItemShow()
|
||||||
{
|
{
|
||||||
if (_LastItemSelected != null)
|
if (_ItemSelected != null)
|
||||||
ItemLookup[_LastItemSelected.ItemID].ItemShow();
|
ItemLookup[_ItemSelected.ItemID].ItemShow();
|
||||||
}
|
}
|
||||||
private int _Scrolling = 0; // Volian Property Snippet
|
private int _Scrolling = 0; // Volian Property Snippet
|
||||||
public int Scrolling
|
public int Scrolling
|
||||||
|
@ -15,6 +15,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
|
if (_DisplayRTB != null) _DisplayRTB.SaveText();
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
|
@ -173,7 +173,7 @@ namespace Volian.Controls.Library
|
|||||||
this.LinkClicked += new LinkClickedEventHandler(onLinkClicked);
|
this.LinkClicked += new LinkClickedEventHandler(onLinkClicked);
|
||||||
this.KeyPress += new KeyPressEventHandler(onKeyPress);
|
this.KeyPress += new KeyPressEventHandler(onKeyPress);
|
||||||
this.KeyDown += new KeyEventHandler(onKeyDown);
|
this.KeyDown += new KeyEventHandler(onKeyDown);
|
||||||
this.Leave += new EventHandler(DisplayRTB_Leave);
|
//this.Leave += new EventHandler(DisplayRTB_Leave);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -201,7 +201,7 @@ namespace Volian.Controls.Library
|
|||||||
this.LinkClicked += new LinkClickedEventHandler(onLinkClicked);
|
this.LinkClicked += new LinkClickedEventHandler(onLinkClicked);
|
||||||
this.KeyPress += new KeyPressEventHandler(onKeyPress);
|
this.KeyPress += new KeyPressEventHandler(onKeyPress);
|
||||||
this.KeyDown += new KeyEventHandler(onKeyDown);
|
this.KeyDown += new KeyEventHandler(onKeyDown);
|
||||||
this.Leave += new EventHandler(DisplayRTB_Leave);
|
//this.Leave += new EventHandler(DisplayRTB_Leave);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region ApplicationSupport
|
#region ApplicationSupport
|
||||||
@ -377,15 +377,19 @@ namespace Volian.Controls.Library
|
|||||||
_LinkClickedEventArgs = args;
|
_LinkClickedEventArgs = args;
|
||||||
if (LinkModifyTran != null) LinkModifyTran(sender, args);
|
if (LinkModifyTran != null) LinkModifyTran(sender, args);
|
||||||
}
|
}
|
||||||
void DisplayRTB_Leave(object sender, EventArgs e)
|
//void DisplayRTB_Leave(object sender, EventArgs e)
|
||||||
{
|
//{
|
||||||
// Save returns true if text was not changed or if change was saved successfully.
|
// // Save returns true if text was not changed or if change was saved successfully.
|
||||||
if (ReadOnly) return;
|
// if (ReadOnly) return;
|
||||||
// if selecting another rtb, save. If selecting the info panel don't because
|
// // if selecting another rtb, save. If selecting the info panel don't because
|
||||||
// we're still on a valid item.??
|
// // we're still on a valid item.??
|
||||||
|
|
||||||
// RHM?? why commented out. bool success = _origVlnText.Save((RichTextBox)this);
|
//}
|
||||||
// RHM?? why commented out.if (!success) Console.WriteLine("Failed to save text: {0}", this.Text);
|
public void SaveText()
|
||||||
|
{
|
||||||
|
if (ReadOnly) return;
|
||||||
|
bool success = _origVlnText.Save((RichTextBox)this);
|
||||||
|
if (!success) Console.WriteLine("Failed to save text: {0}", this.Text);
|
||||||
}
|
}
|
||||||
private Point _savcurpos;
|
private Point _savcurpos;
|
||||||
private void onLinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e)
|
private void onLinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user