B2021-003: Incoming transitions: random Enable/disable of ‘Convert Selected Text’ button & crashing
This commit is contained in:
parent
8ddf84e0bc
commit
f79ff651a5
@ -1335,6 +1335,7 @@ namespace Volian.Controls.Library
|
||||
this.lbSrchResultsIncTrans.SelectedIndexChanged += new System.EventHandler(this.lbSrchResults_SelectedValueChanged);
|
||||
this.lbSrchResultsIncTrans.ItemClick += new System.EventHandler(this.lbSrchResultsIncTrans_ItemClicked);
|
||||
this.lbSrchResultsIncTrans.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lbSrchResults_MouseMove);
|
||||
this.lbSrchResultsIncTrans.ItemCheck += this.lbSrchResultsIncTrans_ItemChecked;
|
||||
//
|
||||
// panSearchButtons
|
||||
//
|
||||
@ -1687,9 +1688,9 @@ namespace Volian.Controls.Library
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private DevComponents.DotNetBar.TabControl tabSearchTypes;
|
||||
private DevComponents.DotNetBar.TabControl tabSearchTypes;
|
||||
private DevComponents.DotNetBar.TabControlPanel tabControlPanel2;
|
||||
private DevComponents.DotNetBar.TabControlPanel tabControlPanel5;
|
||||
private DevComponents.DotNetBar.TabItem tabROSearch;
|
||||
|
@ -1171,6 +1171,19 @@ namespace Volian.Controls.Library
|
||||
LastResultsMouseOverIndex = ResultsMouseOverIndex;
|
||||
}
|
||||
}
|
||||
// B2021-003: random crash on lbSrchResultsIncTrans selection. Originally, only ItemClicked was used
|
||||
// to track how many items in the list were checked. However, this gets called for both
|
||||
// the clicked & checked events, so the count of checked items was not accurate (this count,
|
||||
// IncTransSelectedCount was incremented/decremented when event occurred). The reason that the clicked
|
||||
// event needs to be used is that the sender contains the bound item (proms item) but the checked
|
||||
// event does not, so both are needed. The tracking of checked items is done to enable/disable
|
||||
// the 'Convert Selected to Text' button. The fix was to flag from the ItemChecked event that the
|
||||
// item was checked not just selected, so that the code in Clicked only runs for a check event.
|
||||
private bool didcheck = false;
|
||||
private void lbSrchResultsIncTrans_ItemChecked(object sender, EventArgs e)
|
||||
{
|
||||
didcheck = true;
|
||||
}
|
||||
// C2020-033: lbSrchResultsIncTrans_ItemClicked is used to check permissions of a selection before allowing an
|
||||
// item to be clicked and to turn on/off the btnTranCvtSelToTxt button for converting selected to test.
|
||||
// Two variables are used to keep track if items are checked in the list box:
|
||||
@ -1183,23 +1196,27 @@ namespace Volian.Controls.Library
|
||||
private void lbSrchResultsIncTrans_ItemClicked(object sender, EventArgs e)
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
ItemBindingData ibd = lbi.Tag as ItemBindingData;
|
||||
ItemInfo ii = ibd.DataItem as ItemInfo;
|
||||
bool allowNonAdmin = IncTranCvtPerm();
|
||||
if (lbi.CheckState == CheckState.Checked && ii != null)
|
||||
if (didcheck && lbi != null)
|
||||
{
|
||||
if (!allowNonAdmin && !UserInfo.CanEdit(MyUserInfo, ii.MyDocVersion))
|
||||
ItemBindingData ibd = lbi.Tag as ItemBindingData;
|
||||
ItemInfo ii = ibd.DataItem as ItemInfo;
|
||||
bool allowNonAdmin = IncTranCvtPerm();
|
||||
if (lbi.CheckState == CheckState.Checked && ii != null)
|
||||
{
|
||||
FlexibleMessageBox.Show("You do not have permission to edit the procedure, section, or step.",
|
||||
"Convert Transition to Text", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
lbi.CheckState = CheckState.Unchecked;
|
||||
if (!allowNonAdmin && !UserInfo.CanEdit(MyUserInfo, ii.MyDocVersion))
|
||||
{
|
||||
FlexibleMessageBox.Show("You do not have permission to edit the procedure, section, or step.",
|
||||
"Convert Transition to Text", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
lbi.CheckState = CheckState.Unchecked;
|
||||
}
|
||||
else
|
||||
if (!JustDidSelection) IncTransSelectedCount++;
|
||||
}
|
||||
else
|
||||
if (!JustDidSelection) IncTransSelectedCount++;
|
||||
if (!JustDidSelection && IncTransSelectedCount > 0) IncTransSelectedCount--; // user unchecked an item
|
||||
if (!JustDidSelection) btnTranCvtSelToTxt.Enabled = IncTransSelectedCount > 0;
|
||||
}
|
||||
else
|
||||
if (!JustDidSelection && IncTransSelectedCount > 0) IncTransSelectedCount--; // user unchecked an item
|
||||
if (!JustDidSelection) btnTranCvtSelToTxt.Enabled = IncTransSelectedCount > 0;
|
||||
didcheck = false;
|
||||
JustDidSelection = false;
|
||||
}
|
||||
private bool _ProcessingSelectedValueChanged = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user