cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-527364%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3EAggiungi%20casella%20calendario%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-527364%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3ECIAO%2C%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3ESto%20cercando%20di%20creare%20un'interfaccia%20utente%20per%20selezionare%20le%20date.%20Ho%20aggiunto%20una%20casella%20di%20pulsanti%20che%20aggiunger%C3%A0%20la%20casella%20del%20calendario%20alla%20casella%20del%20pannello%20ma%20ogni%20volta%20che%20faccio%20clic%2C%20continuer%C3%A0%20ad%20aggiungere%20elementi%20alla%20casella%20del%20pannello.%20Voglio%20nascondere%20la%20casella%20del%20calendario%20al%20secondo%20clic.%20C'%C3%A8%20un%20modo%20per%20raggiungere%20questo%20obiettivo%3F%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jacksmith12_0-1658970097030.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jacksmith12_0-1658970097030.png%22%20style%3D%22width%3A%20291px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F44392iD3777B35E963C2AC%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Jacksmith12_0-1658970097030.png%22%20alt%3D%22Jacksmith12_0-1658970097030.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3EEcco%20il%20mio%20codice%3A%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Esd%3DToday()%3B%0Aed%3DToday()%3B%0ANew%20Window(%20%22Query%20Date%22%2C%20%26lt%3B%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3CLINGO-LABS%20id%3D%22lingo-labs-527364%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CLINGO-LABEL%3EModellazione%20statistica%20avanzata%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ERicerche%20sui%20consumatori%20e%20sul%20mercato%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECombinazione%20e%20pulizia%20dei%20dati%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIngegneria%20della%20qualit%C3%A0%20e%20dei%20processi%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FCODE%3E%3CLINGO-SUB%20id%3D%22lingo-sub-527646%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERi%3A%20Aggiungi%20casella%20calendario%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-527646%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ESolo%20per%20espandere%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2687%22%20target%3D%22_blank%22%3E%20%40txnelson%3C%2FA%3E%20's%20suggerimento%2C%20eccone%20un%20altro.%20Illustra%20solo%20una%20tecnica.%20Non%20%C3%A8%20affatto%20uno%20script%20completo.%20Mostra%20anche%20che%20l'utilizzo%20di%20un%20formato%20di%20data%20con%20la%20casella%20di%20modifica%20del%20numero%20fornir%C3%A0%20automaticamente%20un'opzione%20di%20calendario.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0A%0Asd%20%3D%20ed%20%3D%20Today()%3B%0Avisible%20%3D%200%3B%0A%0ANew%20Window(%20%22Query%20Date%22%2C%0A%20%26lt%3B%26lt%3B%20Modal%2C%0A%20Panel%20Box(%20%22From%20Time%22%2C%0A%20%20Line%20Up%20Box(%20N%20Col(%203%20)%2C%0A%20%20%20Text%20Box(%20%22Start%22%20)%2C%0A%20%20%20Number%20Edit%20Box(%20sd%2C%0A%20%20%20%20%26lt%3B%26lt%3B%20Set%20Format(%20Format(%20%22m%2Fd%2Fy%22%2C%2012%20)%20)%0A%20%20%20)%2C%0A%20%20%20cb1%20%3D%20Calendar%20Box(%20%26lt%3B%26lt%3B%20Visibility(%20Collapse%20)%20)%2C%0A%20%20%20Text%20Box(%20%22End%22%20)%2C%0A%20%20%20Number%20Edit%20Box(%20ed%2C%0A%20%20%20%20%26lt%3B%26lt%3B%20Set%20Format(%20Format(%20%22m%2Fd%2Fy%22%2C%2012%20)%20)%0A%20%20%20)%2C%0A%20%20%20cb2%20%3D%20Calendar%20Box(%20%26lt%3B%26lt%3B%20Visibility(%20Collapse%20)%20)%0A%20%20)%0A%20)%2C%0A%20bb%20%3D%20Button%20Box(%20%22Show%20Calendars%22%2C%0A%20%20If(%20visible%2C%0A%20%20%20%7B%20cb1%2C%20cb2%20%7D%20%26lt%3B%26lt%3B%20Visibility(%20Collapse%20)%3B%0A%20%20%20bb%20%26lt%3B%26lt%3B%20Set%20Button%20Name(%20%22Show%20Calendars%22%20)%2C%0A%20%20%20%7B%20cb1%2C%20cb2%20%7D%20%26lt%3B%26lt%3B%20Visibility(%20Visible%20)%3B%0A%20%20%20bb%20%26lt%3B%26lt%3B%20Set%20Button%20Name(%20%22Hide%20Calendars%22%20)%3B%0A%20%20)%3B%0A%20%20visible%20%3D%20!visible%3B%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-527404%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERi%3A%20Aggiungi%20casella%20calendario%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-527404%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EEcco%20un%20modo%20per%20gestirlo%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0Asd%20%3D%20Today()%3B%0Aed%20%3D%20Today()%3B%0Aflag%20%3D%200%3B%0ANew%20Window(%20%22Query%20Date%22%2C%0A%20%26lt%3B%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
Jackie_
Level VI

Append calendar box

Hi,

 

I am trying to create a UI to select dates. I have added a button box which will append calendar box to the panel box but every time I click, it will keep adding elements to the panel box. I want to hide the calendar box on second click. Is there a way to achieve this?

Jacksmith12_0-1658970097030.png

 

Here's my code:

sd=Today();
ed=Today();
New Window( "Query Date", <<Modal,
 HListBox(
   Panel1= PanelBox( "From Time"),
   	Button Box("click",
   	Panel1 << removeALl;
   	Panel1 << Append(scal1 = Calendar Box(, SetFunction(Function({this}, sd1=scal1<< Get Date) )));
   )
      
    )

);
2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Append calendar box

Here is one way to handle it

Names Default To Here( 1 );
sd = Today();
ed = Today();
flag = 0;
New Window( "Query Date",
	<<Modal,
	H List Box(
		Panel1 = Panel Box( "From Time" ),
		Button Box( "click",
			If( flag == 0,
				Panel1 << removeALl;
				Panel1 << Append( scal1 = Calendar Box( , SetFunction( Function( {this}, sd1 = scal1 << Get Date ) ) ) );
				flag = 1;
			,
				scal1 << visibility( "collapse" )
			)
      
		)
	)
);
Jim

View solution in original post

Re: Append calendar box

Just to expand on @txnelson's suggestion, here is another. It only illustrates a technique. It is not a complete script by any means. It also shows that using a date format with the Number Edit Box will automatically provide a calendar option.

 

Names Default To Here( 1 );

sd = ed = Today();
visible = 0;

New Window( "Query Date",
	<< Modal,
	Panel Box( "From Time",
		Line Up Box( N Col( 3 ),
			Text Box( "Start" ),
			Number Edit Box( sd,
				<< Set Format( Format( "m/d/y", 12 ) )
			),
			cb1 = Calendar Box( << Visibility( Collapse ) ),
			Text Box( "End" ),
			Number Edit Box( ed,
				<< Set Format( Format( "m/d/y", 12 ) )
			),
			cb2 = Calendar Box( << Visibility( Collapse ) )
		)
	),
	bb = Button Box( "Show Calendars",
		If( visible,
			{ cb1, cb2 } << Visibility( Collapse );
			bb << Set Button Name( "Show Calendars" ),
			{ cb1, cb2 } << Visibility( Visible );
			bb << Set Button Name( "Hide Calendars" );
		);
		visible = !visible;
	)
);

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Append calendar box

Here is one way to handle it

Names Default To Here( 1 );
sd = Today();
ed = Today();
flag = 0;
New Window( "Query Date",
	<<Modal,
	H List Box(
		Panel1 = Panel Box( "From Time" ),
		Button Box( "click",
			If( flag == 0,
				Panel1 << removeALl;
				Panel1 << Append( scal1 = Calendar Box( , SetFunction( Function( {this}, sd1 = scal1 << Get Date ) ) ) );
				flag = 1;
			,
				scal1 << visibility( "collapse" )
			)
      
		)
	)
);
Jim

Re: Append calendar box

Just to expand on @txnelson's suggestion, here is another. It only illustrates a technique. It is not a complete script by any means. It also shows that using a date format with the Number Edit Box will automatically provide a calendar option.

 

Names Default To Here( 1 );

sd = ed = Today();
visible = 0;

New Window( "Query Date",
	<< Modal,
	Panel Box( "From Time",
		Line Up Box( N Col( 3 ),
			Text Box( "Start" ),
			Number Edit Box( sd,
				<< Set Format( Format( "m/d/y", 12 ) )
			),
			cb1 = Calendar Box( << Visibility( Collapse ) ),
			Text Box( "End" ),
			Number Edit Box( ed,
				<< Set Format( Format( "m/d/y", 12 ) )
			),
			cb2 = Calendar Box( << Visibility( Collapse ) )
		)
	),
	bb = Button Box( "Show Calendars",
		If( visible,
			{ cb1, cb2 } << Visibility( Collapse );
			bb << Set Button Name( "Show Calendars" ),
			{ cb1, cb2 } << Visibility( Visible );
			bb << Set Button Name( "Hide Calendars" );
		);
		visible = !visible;
	)
);

Recommended Articles