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%3EAjouter%20une%20zone%20de%20calendrier%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-527364%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3ESalut%2C%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3EJ'essaie%20de%20cr%C3%A9er%20une%20interface%20utilisateur%20pour%20s%C3%A9lectionner%20des%20dates.%20J'ai%20ajout%C3%A9%20une%20zone%20de%20boutons%20qui%20ajoutera%20une%20zone%20de%20calendrier%20%C3%A0%20la%20zone%20de%20panneau%2C%20mais%20chaque%20fois%20que%20je%20clique%2C%20elle%20continuera%20%C3%A0%20ajouter%20des%20%C3%A9l%C3%A9ments%20%C3%A0%20la%20zone%20de%20panneau.%20Je%20souhaite%20masquer%20la%20zone%20du%20calendrier%20au%20deuxi%C3%A8me%20clic.%20Existe-t-il%20un%20moyen%20d'y%20parvenir%20%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%3EVoici%20mon%20code%20%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%3EMod%C3%A9lisation%20statistique%20avanc%C3%A9e%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%C3%89tudes%20de%20consommation%20et%20de%20march%C3%A9%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EM%C3%A9lange%20et%20nettoyage%20des%20donn%C3%A9es%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIng%C3%A9nierie%20Qualit%C3%A9%20et%20Proc%C3%A9d%C3%A9s%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%3ERe%26nbsp%3B%3A%20Ajouter%20une%20bo%C3%AEte%20de%20calendrier%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-527646%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJuste%20pour%20d%C3%A9velopper%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%20suggestion%2C%20en%20voici%20une%20autre.%20Il%20ne%20fait%20qu'illustrer%20une%20technique.%20Ce%20n'est%20en%20aucun%20cas%20un%20script%20complet.%20Il%20montre%20%C3%A9galement%20que%20l'utilisation%20d'un%20format%20de%20date%20avec%20la%20zone%20d'%C3%A9dition%20num%C3%A9rique%20fournira%20automatiquement%20une%20option%20de%20calendrier.%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%3ERe%26nbsp%3B%3A%20Ajouter%20une%20bo%C3%AEte%20de%20calendrier%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-527404%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVoici%20une%20fa%C3%A7on%20de%20le%20g%C3%A9rer%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