For some reason when I drop a FastObjectListView on a form and turn on ShowGroups in the properties and save the form the ShowGroups property keeps switching back to false.
If I switch the control to an ObjectListView it behaves as expected and works fine.
If I open the designer file and add ShowGroups = true; to the FastObjectListView control it works.
As soon as I open the form in Visual Studio 2012 it reverts back to ShowGroups = false;
Any idea why?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think it has to do with the default value being true (according to the designer), but actually I set it to false, since that's more commonly what's required.
For the moment, just set the ShowGroups value in code after the InitializeComponent() call.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. I just wanted to make sure I wasn't doing anything stupid. I will continue to turn on grouping after the InitializeComponent() call for now.
Also every time you release OLV I have to apply a small patch to it because my particular project uses a DecimalCellEditor as well as a NumericalTextBox. (Users complained about the up/down arrows so I use a textbox that only accepts numbers) Would you be interested in my changes so you can evaluate if you want to add them to a future release? Just let me know.
Richard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. I just wanted to make sure I wasn't doing anything stupid. I will
continue to turn on grouping after the InitializeComponent() call for now.
Also every time you release OLV I have to apply a small patch to it
because my particular project uses a DecimalCellEditor as well as a
NumericalTextBox. (Users complained about the up/down arrows so I use a
textbox that only accepts numbers) Would you be interested in my changes so
you can evaluate if you want to add them to a future release? Just let me
know.
Here are some of my mods I made and are free for anyone to use. Sorry if the formatting is terrible... I can't figure out this SourceForge editor and c#...
The first allows for decimal values.
In EditorRegistry.cs I added this line to InitializeStandardTypes()
this.Register(typeof(Decimal), typeof(DecimalCellEditor));
In CellEditors.cs I added this class as well as changed all the maximum and minimum values to hold 10 digits instead of your default 7. 7 wasn't enough for my needs.
/// <summary>
/// This editor simply shows and edits decimal values
/// </summary>
internal class DecimalCellEditor : NumericUpDown
{
public DecimalCellEditor()
{
DecimalPlaces = 2;
Minimum = 0;
Maximum = 9999999999;
}
public new decimal Value
{
get { return Convert.ToDecimal(base.Value); }
set { base.Value = Convert.ToDecimal(value); }
}
}
/// <summary>
/// This editor simply shows and edits floating point values.
/// </summary>
/// <remarks>You can intercept the CellEditStarting event if you want
/// to change the characteristics of the editor. For example, by increasing
/// the number of decimal places.</remarks>
[ToolboxItem(false)]
public class NumberTextCellEditor : NumericTextBox
{
/// <summary>
///
/// </summary>
public NumberTextCellEditor()
{
this.TextAlign = HorizontalAlignment.Right;
this.AllowDecimals = false;
this.AllowCommas = true;
this.AllowNegatives = false;
}
/// <summary>
/// Gets or sets the value shown by this editor
/// </summary>
public new decimal Value
{
get { return Convert.ToDecimal(base.Text); }
set { base.Text = value.ToString(); }
}
}
I created a new file called NumericTextBox.cs and added it to the CellEditing directory
This allows me to use a textbox for numbers instead of the default up/down control which my users tend to complain a lot about.
using System;
using System.Globalization;
using System.Windows.Forms;
namespace BrightIdeasSoftware
{
public class NumericTextBox : TextBox
{
protected override void OnKeyPress(KeyPressEventArgs e)
{
base.OnKeyPress(e);
NumberFormatInfo numberFormatInfo = CultureInfo.CurrentCulture.NumberFormat;
string decimalSeparator = numberFormatInfo.NumberDecimalSeparator;
string groupSeparator = numberFormatInfo.NumberGroupSeparator;
string negativeSign = numberFormatInfo.NegativeSign;
string keyInput = e.KeyChar.ToString();
if (Char.IsDigit(e.KeyChar))
{
// Digits are OK
}
else if (AllowDecimals &&
keyInput.Equals(decimalSeparator) &&
!this.Text.Contains("."))
{
// Decimals are OK as long as there is only one.
}
else if (AllowCommas &&
keyInput.Equals(groupSeparator))
{
// Comma separator is OK
}
else if (e.KeyChar == '\b')
{
// Backspace key is OK
}
else if (AllowNegatives &&
keyInput.Equals("-") &&
string.IsNullOrEmpty(Text) &&
Text.IndexOf("-") == -1)
{
// Decimal separator is OK in the first position
}
else if (AllowSpace && e.KeyChar == ' ')
{
// Space key is OK
}
else
{
// Swallow this invalid key
e.Handled = true;
}
}
#region Properties
public int IntValue
{
get { return Int32.Parse(Text); }
}
public decimal DecimalValue
{
get { return Decimal.Parse(Text); }
}
public bool AllowDecimals { get; set; }
public bool AllowCommas { get; set; }
public bool AllowNegatives { get; set; }
public bool AllowSpace { get; set; }
#endregion Properties
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
this issue is still present in version 2.9.1
took me HOURS to find, because I always thought I was doing something wrong...
would be cool if fixed in new update...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ObjectListView Version 2.7.0 (2014/02/26)
For some reason when I drop a FastObjectListView on a form and turn on ShowGroups in the properties and save the form the ShowGroups property keeps switching back to false.
If I switch the control to an ObjectListView it behaves as expected and works fine.
If I open the designer file and add ShowGroups = true; to the FastObjectListView control it works.
As soon as I open the form in Visual Studio 2012 it reverts back to ShowGroups = false;
Any idea why?
I think it has to do with the default value being true (according to the designer), but actually I set it to false, since that's more commonly what's required.
For the moment, just set the ShowGroups value in code after the InitializeComponent() call.
Thanks. I just wanted to make sure I wasn't doing anything stupid. I will continue to turn on grouping after the InitializeComponent() call for now.
Also every time you release OLV I have to apply a small patch to it because my particular project uses a DecimalCellEditor as well as a NumericalTextBox. (Users complained about the up/down arrows so I use a textbox that only accepts numbers) Would you be interested in my changes so you can evaluate if you want to add them to a future release? Just let me know.
Richard.
I'm always happy to hear how I could improve OLV. Give me a suggestion or
some code and I'll see about having it included.
Regards,
Phillip
Phillip Piper www.bigfoot.com/~phillip_piper phillip_piper@bigfoot.com
A man's life does not consist in the abundance of his possessions
On 4 July 2014 22:04, Computer Logix computerlogix@users.sf.net wrote:
Here are some of my mods I made and are free for anyone to use. Sorry if the formatting is terrible... I can't figure out this SourceForge editor and c#...
The first allows for decimal values.
In EditorRegistry.cs I added this line to InitializeStandardTypes()
this.Register(typeof(Decimal), typeof(DecimalCellEditor));
In CellEditors.cs I added this class as well as changed all the maximum and minimum values to hold 10 digits instead of your default 7. 7 wasn't enough for my needs.
I created a new file called NumericTextBox.cs and added it to the CellEditing directory
This allows me to use a textbox for numbers instead of the default up/down control which my users tend to complain a lot about.
using System;
using System.Globalization;
using System.Windows.Forms;
namespace BrightIdeasSoftware
{
public class NumericTextBox : TextBox
{
protected override void OnKeyPress(KeyPressEventArgs e)
{
base.OnKeyPress(e);
}
}
this issue is still present in version 2.9.1
took me HOURS to find, because I always thought I was doing something wrong...
would be cool if fixed in new update...