cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
uday_guntupalli
Level VIII

Format a Number Col Edit Box

All, 
     I would like to use a number col edit box similar to a number edit box in that, I would like to format it to display a date. However, as shown in the following example the format doesn't seem to be accepted the same way ? Can someone point out whats wrong in the following approach ? 

 

// Using Number Col Edit Box 
nR = 7; NEB1 = Number Col Edit Box("StartDate",Repeat(Today() - 30 * 24 * 60 * 60,nR)); NEB1 << set format(format("ddMonyyyy")); NEB2 = Number Col Edit Box("StartDate",Repeat(Today(), nR )); NEB2 << set format(format("ddMonyyyy")); TB1 = Table Box(NEB1,NEB2); NW = New Window("test",TB1); // Using number edit box numbox = Number Edit Box( 0 ,<< set format(format("ddMonyyyy")), << set(Today())); NW1 = New Window( "Example", numbox );

 image.png

Best
Uday
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Format a Number Col Edit Box

Here is an example of how this message works:

 

Names Default to Here( 1 );

now = Today();

then = now - In Days( 3 ) - In Hours( 5 );

before = then - In Days( 2 ) + In Hours( 3 );

New Window( "Format Number Col Edit Box",
	Outline Box( "Dates",
		Table Box(
			String Col Box( "Event", { "First", "Second", "Third" } ),
			nceb = Number Col Edit Box( "Date", { now, then, before } )
		)
	)
);

nceb << Set Format( 30, 100 );

 

I don't know what kind of date format you want, so you might have to try different integers to get the one that you want.

View solution in original post

4 REPLIES 4

Re: Format a Number Col Edit Box

Right, the protocol for the Number Edit Box and the Number Col Edit Box are not the same. In particular, the << Set Format() message is different for these two objects. Per the Scripting Guide, this message uses a number (code) for the format specification of the object that you want to use:

 

Capture.PNG

Re: Format a Number Col Edit Box

Here is an example of how this message works:

 

Names Default to Here( 1 );

now = Today();

then = now - In Days( 3 ) - In Hours( 5 );

before = then - In Days( 2 ) + In Hours( 3 );

New Window( "Format Number Col Edit Box",
	Outline Box( "Dates",
		Table Box(
			String Col Box( "Event", { "First", "Second", "Third" } ),
			nceb = Number Col Edit Box( "Date", { now, then, before } )
		)
	)
);

nceb << Set Format( 30, 100 );

 

I don't know what kind of date format you want, so you might have to try different integers to get the one that you want.

uday_guntupalli
Level VIII

Re: Format a Number Col Edit Box

@Mark_Bailey

           Thank you . While that works, it is not intuitive that a number will implement some kind of formatting on the number col edit box, rather than the more intuitive format that the number edit box allows. I will be adding this to the wish list. 

 

 

Best
Uday

Re: Format a Number Col Edit Box

This method of specifying the format is the original way. It is the way that we used to set the format for the Number Col Box object. I was surprised to see that the newer Number Col Edit Box object still used it.