Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to edit TimeSpan data in standalone and in-place mode

$
0
0

Starting with the 14.2 version, the XtraEditors library contains TimeSpanEdit out of the box.


Obsolete:

This example shows how to create a TimeEdit descendant which will allow editing and displaying TimeSpan values, and entering more than 24 hours.

See Also:
How to create a custom editor that will allow editing TimeSpan values

Question Comments

Added By: Stefan Guc at: 6/7/2013 9:36:08 PM    

Hi,

Can this be upgraded to v2013 vol 1.4.

Thanks,
Stefan.

Added By: Norbert Kustra at: 6/13/2013 7:09:19 AM    

Hello, I am waiting for 2013.1.4 upgrade.
Thanks Norbert

Added By: Arnaud Chevallier at: 11/29/2013 2:34:35 AM    

Hello All,

When I use this editor directly in a DevExpress.XtraBars.Ribbon.RibbonForm the Designer generates this code:

            //
            // tsEditDuration
            //
            this.tsEditDuration.EditValue = System.TimeSpan.Parse("00:00:00");
            this.tsEditDuration.Location = new System.Drawing.Point(74, 50);
            this.tsEditDuration.MenuManager = this.ribbon;
            this.tsEditDuration.Name = "tsEditDuration";
            this.tsEditDuration.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.tsEditDuration.Properties.DisplayFormat.FormatString = "HH:mm:ss";
            this.tsEditDuration.Properties.EditFormat.FormatString = "HH:mm:ss";
            this.tsEditDuration.Properties.Mask.EditMask = "HH:mm:ss";
            this.tsEditDuration.Size = new System.Drawing.Size(100, 20);
            this.tsEditDuration.TabIndex = 0;

So far everythings are fine.

But when I use this editor in a custom control derived from DevExpress.XtraEditors.XtraUserControl the Designer generates this code:

            //
            // tsEditDuration
            //
            this.tsEditDuration.EditValue = System.TimeSpan.Parse("00:00:00");
            this.tsEditDuration.Location = new System.Drawing.Point(215, 110);
            this.tsEditDuration.Name = "tsEditDuration";
            this.tsEditDuration.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.tsEditDuration.Properties.DisplayFormat.FormatString = "HH:mm:ss";
            this.tsEditDuration.Properties.EditFormat.FormatString = "HH:mm:ss";
            this.tsEditDuration.Properties.EditValueChangedFiringMode = DevExpress.XtraEditors.Controls.EditValueChangedFiringMode.Default;
            this.tsEditDuration.Properties.Mask.EditMask = "(0(\\R.([0-1]\\d|2[1-3])|\\d)|1(\\R.(0\\d|1[0-1])|\\d)|2\\d|3[0-5])\\R:[0-5]\\d\\R:[0-5]\\d";
            this.tsEditDuration.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;
            this.tsEditDuration.Size = new System.Drawing.Size(89, 20);
            this.tsEditDuration.TabIndex = 14;

In the second case I can't edit the value. The EditMask string is displayed instead of the actual value. As a workaround you need to edit the designer generated code.

Regards,
Arnaud.

Added By: Constant (DevExpress Support) at: 12/24/2013 3:37:58 AM    

I have tried to replicate the issue but have not noticed any issues. If you still experience the same problem, please create a separate ticket regarding it and describe the issue in greater detail. A sample project demonstrating the problem will be very helpful.

Added By: Jackson Cheng at: 7/9/2014 3:10:17 AM    

Hi,
How can I force the format to be like 00:00:00 instead of 0:00:00?
I tried changing the culture fed to the manager or the _Hxxx in FormatInfo but they seem to be the wrong place.
Thanks.

Added By: Mariya (DevExpress Support) at: 7/9/2014 4:59:00 AM    Hi Jackson,
I have created a new ticket on your behalf and passed it to our team for research: How to change TimeSpan value format in the TimeEdit descendant class .

Added By: Trungpos SD at: 9/9/2014 1:54:57 AM    

How can I export it to a .dll file?

Added By: Andrey (DevExpress Support) at: 9/9/2014 4:36:55 AM    

Hello,
To accomplish this task, create a new Class Library project and then replace default code with custom control class code.

Should you have further questions, let me know.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>