You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by "Adarsh Y.V" <ad...@gmail.com> on 2011/10/03 07:59:39 UTC

keyboard short-cuts for buttons

How can we enable key board short-cuts (if mouse is not present) for buttons
in apache pivot  ??

Thanks

Re: keyboard short-cuts for buttons

Posted by sdf <ad...@gmail.com>.
hi 
this my java file for a simple bxml page for setting destination folder
during installation. 
can someone show a sample to add a key pressed listener(for next button like
ALT+N..). how to do it?? 

public class DestinationFolderScreen { 

        @BXML 
        org.apache.pivot.wtk.Label InstallLocation; 
        @BXML 
        org.apache.pivot.wtk.PushButton next; 
        @BXML 
        org.apache.pivot.wtk.TextInput destinationFolder; 
        @BXML 
        org.apache.pivot.wtk.BoxPane StackLayer4; 
        @BXML 
        org.apache.pivot.wtk.ImageView InstallerBackground; 
        @BXML 
        org.apache.pivot.wtk.PushButton browse; 
        @BXML 
        org.apache.pivot.wtk.PushButton cancel; 
        @BXML 
        org.apache.pivot.wtk.BoxPane StackLayer2; 
        @BXML 
        org.apache.pivot.wtk.PushButton back; 
        @BXML 
        org.apache.pivot.wtk.BoxPane StackLayer1; 
        @BXML 
        org.apache.pivot.wtk.Label DestinationFolder; 

        @Override 
        public void initialize(final Map&lt;String, Object&gt; properties,
URL url, 
                        Resources resource) {	

                next.getButtonPressListeners().add(new ButtonPressListener()
{ 
                        @Override 
                        public void buttonPressed(Button button) { 
                                if (true) { 

                                        nextPress(properties); 
                                }}}); 

                cancel.getButtonPressListeners().add(new
ButtonPressListener() { 
                        @Override 
                        public void buttonPressed(Button button) { 
                                
                                                               
closingWindow(); 
                                                }}); 

                back.getButtonPressListeners().add(new ButtonPressListener()
{ 
                        @Override 
                        public void buttonPressed(Button button) { 
                                if (true) { 

                                        backPress(); 
                                }}}); 

                browse.getButtonPressListeners().add(new
ButtonPressListener() { 
                        @Override 
                        public void buttonPressed(Button button) { 
                                if (true){ 

                                        FileBrowserSheet.Mode
fileBrowserSheetMode = FileBrowserSheet.Mode 
                                                        .valueOf("SAVE_TO"); 
                                        final FileBrowserSheet
fileBrowserSheet = new FileBrowserSheet(); 
                                       
fileBrowserSheet.getStyles().put("hideDisabledFiles", 
                                                        "true"); 
                                       
fileBrowserSheet.setMode(fileBrowserSheetMode); 
                                        fileBrowserSheet.open(window, new
SheetCloseListener() { 
                                                @Override 
                                                public void
sheetClosed(Sheet sheet) { 
                                                        if
(sheet.getResult()) { 
                                                                File file =
fileBrowserSheet.getSelectedFile(); 
                                                               
destinationFolder.setText(file.getPath()); 
                                                        } 
                                                }});}}});}}

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/keyboard-short-cuts-for-buttons-tp3388941p3395718.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: keyboard short-cuts for buttons

Posted by sdf <ad...@gmail.com>.
hi
this my java file for a simple bxml page for setting destination folder
during installation.
can someone show a sample to add a key pressed listener(for next button like
ALT+N..). how to do it??

public class DestinationFolderScreen {

	@BXML
	org.apache.pivot.wtk.Label InstallLocation;
	@BXML
	org.apache.pivot.wtk.PushButton next;
	@BXML
	org.apache.pivot.wtk.TextInput destinationFolder;
	@BXML
	org.apache.pivot.wtk.BoxPane StackLayer4;
	@BXML
	org.apache.pivot.wtk.ImageView InstallerBackground;
	@BXML
	org.apache.pivot.wtk.PushButton browse;
	@BXML
	org.apache.pivot.wtk.PushButton cancel;
	@BXML
	org.apache.pivot.wtk.BoxPane StackLayer2;
	@BXML
	org.apache.pivot.wtk.PushButton back;
	@BXML
	org.apache.pivot.wtk.BoxPane StackLayer1;
	@BXML
	org.apache.pivot.wtk.Label DestinationFolder;

	@Override
	public void initialize(final Map&lt;String, Object&gt; properties, URL url,
			Resources resource) {		

		next.getButtonPressListeners().add(new ButtonPressListener() {
			@Override
			public void buttonPressed(Button button) {
				if (true) {

					nextPress(properties);
				}}});

		cancel.getButtonPressListeners().add(new ButtonPressListener() {
			@Override
			public void buttonPressed(Button button) {
				
								closingWindow();
						}});

		back.getButtonPressListeners().add(new ButtonPressListener() {
			@Override
			public void buttonPressed(Button button) {
				if (true) {

					backPress();
				}}});

		browse.getButtonPressListeners().add(new ButtonPressListener() {
			@Override
			public void buttonPressed(Button button) {
				if (true){

					FileBrowserSheet.Mode fileBrowserSheetMode = FileBrowserSheet.Mode
							.valueOf("SAVE_TO");
					final FileBrowserSheet fileBrowserSheet = new FileBrowserSheet();
					fileBrowserSheet.getStyles().put("hideDisabledFiles",
							"true");
					fileBrowserSheet.setMode(fileBrowserSheetMode);
					fileBrowserSheet.open(window, new SheetCloseListener() {
						@Override
						public void sheetClosed(Sheet sheet) {
							if (sheet.getResult()) {
								File file = fileBrowserSheet.getSelectedFile();
								destinationFolder.setText(file.getPath());
							}
						}});}}});}}

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/keyboard-short-cuts-for-buttons-tp3388941p3395715.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: keyboard short-cuts for buttons

Posted by Greg Brown <gk...@verizon.net>.
There is no built-in way to do this. Easiest thing to do is attach a keyboard listener to the button's container or another ancestor and handle the shortcut key presses there.

On Oct 2, 2011, at 10:59 PM, Adarsh Y.V wrote:

> How can we enable key board short-cuts (if mouse is not present) for buttons in apache pivot  ??
> 
> Thanks


Re: keyboard short-cuts for buttons

Posted by Greg Brown <gk...@verizon.net>.
There is no built-in way to do this. Easiest thing to do is attach a keyboard listener to the button's container or another ancestor and handle the shortcut key presses there.

On Oct 2, 2011, at 10:59 PM, Adarsh Y.V wrote:

> How can we enable key board short-cuts (if mouse is not present) for buttons in apache pivot  ??
> 
> Thanks