cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
pmroz
Super User

Enable Calendar Icon in Number Col Edit Box?

I'm creating a tablebox with a number col edit box that will show the date.  However even if I set the format properly the calendar icon doesn't show up.  Here's an example:

nw = new window("Test Calendar",
	neb = number edit box(),
	tb = table box(
		string col box("String", {"One", "Two"}),
		date_nceb = number col edit box("Dates", {., .})
	)
);

neb << Set Format( Format( "ddMonyyyy", 12 ) );
date_nceb << Set Format( Format( "ddMonyyyy", 12 ) );

pmroz_0-1614095964025.png

As you can see for the number edit box the calendar icon shows up properly.  Nothing for the Dates column though.

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Enable Calendar Icon in Number Col Edit Box?

Could it be that Number Col Edit Box doesn't support calendar formatting (yet)?

 

Maybe as possible workaround you could use Col Box (dealing with the values might be a bit more annoying).

Names Default To Here(1);
nw = new window("Test Calendar",
	neb = number edit box(),
	tb = table box(
		string col box("String", {"One", "Two"}),
		Col Box("Dates",
			neb1 = Number edit box(.),
			neb2 = Number edit box(.),
		)
	)
);

neb << Set Format( Format( "ddMonyyyy", 12 ) );
neb1 << Set Format( Format( "ddMonyyyy", 12 ) );
neb2 << Set Format( Format( "ddMonyyyy", 12 ) );
-Jarmo

View solution in original post

jthi
Super User

Re: Enable Calendar Icon in Number Col Edit Box?

If you want to get selected values from ComboBoxes inside Table Box, I would maybe try with XPath:

Names Default to Here( 1 );
nw = new window("Test Colboxes",
	tb = table box(
		string col box("String", {"One", "Two"}),
		date_nceb = number col edit box("Dates", {1, 2}),
		cb = col box("Combo boxes"),
	),
	button box("OK",
		cb_list = cb << XPath("//ComboBoxItem[@selectedItem=\!"true\!"]/text()");
		print(cb_list, nitems(cb_list));
	)
);

cb << append(combo box({"ABC", "DEF"}));
cb << append(combo box({"GHI", "FUBAR"}));

//Show(tb << get xml);
//Show(cb << get xml);

I have found that from time to time with New Window it is easier to get the values by using XPath. I start the by first checking how the XML looks like with << Get Xml as it shows what I can get with XPath. After that I start googling how to get what I want (attributes, values, filtering...) out of the XML by using XPath.

 

 

-Jarmo

View solution in original post

6 REPLIES 6
jthi
Super User

Re: Enable Calendar Icon in Number Col Edit Box?

Could it be that Number Col Edit Box doesn't support calendar formatting (yet)?

 

Maybe as possible workaround you could use Col Box (dealing with the values might be a bit more annoying).

Names Default To Here(1);
nw = new window("Test Calendar",
	neb = number edit box(),
	tb = table box(
		string col box("String", {"One", "Two"}),
		Col Box("Dates",
			neb1 = Number edit box(.),
			neb2 = Number edit box(.),
		)
	)
);

neb << Set Format( Format( "ddMonyyyy", 12 ) );
neb1 << Set Format( Format( "ddMonyyyy", 12 ) );
neb2 << Set Format( Format( "ddMonyyyy", 12 ) );
-Jarmo
pmroz
Super User

Re: Enable Calendar Icon in Number Col Edit Box?

I ended up using col boxes like you suggested.  More overhead but it works.

pmroz
Super User

Re: Enable Calendar Icon in Number Col Edit Box?

New question related to the above.  I'm creating a col box containing combo boxes, and need to loop over them getting the selected value for each combo box.  However there doesn't seem to be a method to doing this.


nw = new window("Test Colboxes",
	tb = table box(
		string col box("String", {"One", "Two"}),
		date_nceb = number col edit box("Dates", {1, 2}),
		cb = col box("Combo boxes"),
	),
	button box("OK",
		cb_list = cb << get;
		print(cb_list, nitems(cb_list));
	)
);

cb << append(combo box({"ABC", "DEF"}));
cb << append(combo box({"GHI", "FUBAR"}));

pmroz_0-1614120481415.png

Clicking OK shows this in the log:

{"", ""}
2

I want to get the list of combo boxes.

txnelson
Super User

Re: Enable Calendar Icon in Number Col Edit Box?

Pete,

Here is the method that I have used many many times.  It is a little wordy but it ends up with a nice list of values.

Names Default to Here( 1 );
nw = New Window( "Test Colboxes",
	tb = Table Box(
		String Col Box( "String", {"One", "Two"} ),
		date_nceb = Number Col Edit Box( "Dates", {1, 2} ),
		cb = Col Box( "Combo boxes" ), 

	),
	Button Box( "OK",
		cb_list = cb << get;
		Print( cb_list, N Items( cb_list ) );
	)
);
valList = {};
i = 1;
Eval(
	Parse(
		"cb << append(cb" || Char( i ) || " = combo box({\!"ABC\!", \!"DEF\!"}, vallist[" || Char( i ) || "] = cb" || Char( i ) ||
		" << get selected  ));"
	)
);
i++;
Eval(
	Parse(
		"cb << append(cb" || Char( i ) || " = combo box({\!"GHI\!", \!"FUBAR\!"}, vallist[" || Char( i ) || "] = cb" || Char( i ) ||
		" << get selected  ));"
	)
);
For( k = 1, k <= i, k++, valList[k] = "" );
Jim
jthi
Super User

Re: Enable Calendar Icon in Number Col Edit Box?

If you want to get selected values from ComboBoxes inside Table Box, I would maybe try with XPath:

Names Default to Here( 1 );
nw = new window("Test Colboxes",
	tb = table box(
		string col box("String", {"One", "Two"}),
		date_nceb = number col edit box("Dates", {1, 2}),
		cb = col box("Combo boxes"),
	),
	button box("OK",
		cb_list = cb << XPath("//ComboBoxItem[@selectedItem=\!"true\!"]/text()");
		print(cb_list, nitems(cb_list));
	)
);

cb << append(combo box({"ABC", "DEF"}));
cb << append(combo box({"GHI", "FUBAR"}));

//Show(tb << get xml);
//Show(cb << get xml);

I have found that from time to time with New Window it is easier to get the values by using XPath. I start the by first checking how the XML looks like with << Get Xml as it shows what I can get with XPath. After that I start googling how to get what I want (attributes, values, filtering...) out of the XML by using XPath.

 

 

-Jarmo
txnelson
Super User

Re: Enable Calendar Icon in Number Col Edit Box?

Excellent solution!

 

I suggest the following modification to the XPath statement.  It stays closer to JSL methodology and would not require the investigation of the XML structure to set the specific syntax.

cb_list = (cb << XPath("//ComboBox")) << get selected;
Jim