I have a DATETIMEPICK control inside my Win32 based application with dd/MM/yy format in my application. When inside the control, if current focus for editing is at field "dd" and user press right arrow key (->) it will change focus to "MM" field for editing month. if press right arrow key again it will focus to "yy" field. if user press right arrow key again when the control is focused on last field(yy), nothing will happen.
I want to override this behavior in such a way that when user press arrow key from last field (yy), the control will go out of DATETIMEPICK control and focus to the next control element in that window. For this purpose, I have overload DATETIMEPICK class and trying to override behavior when VK_RIGHT event occur.
I am unable to identify which field (dd, MM or yy) in DATETIMEPICK control has focus now. Is there anyway I can know if the highlighted field is "yy"?
Related
I am working on a scenario where I have a KendoUI date picker.
is it possible to have a quick selectable option for + 1/2/3/4 weeks,
Suppose, I have selected 1 May in datePicker, then if I press "1".. then it should add 7 days(1 week) in current date.
if I press "2", then it should add 14 days (2 weeks) in current date
using Kendo UI.
is there any solution for this?
The DatePicker has built-in keyboard shortcuts:
https://demos.telerik.com/kendo-ui/datepicker/keyboard-navigation
Focus:
Access key + w focuses the widget
Closed popup:
enter triggers change event
esc closes the popup
alt down arrow opens the popup
alt up arrow closes the popup
Opened popup (date view):
left arrow highlights previous day
right arrow highlights next day
up arrow highlights same day from the previous week
down arrow highlights same day from the next week
ctrl left arrow navigates to previous month
ctrl right arrow navigates to next month
ctrl up arrow navigates to previous view
ctrl down arrow navigates to next view
home highlights first day of the month
end highlights last day of the month
enter if in "month" view selects the highlighted day. In other views navigates to a lower view
The normal DatePicker behavior is for keyboard input to sent to the input box.
Not sure the benefit of having such a specialized dialog feature (1 is +1 week, 2 is +2 week,...) that would prevent typing in an actual date.
There are no component options for specifying your own keyboard handling so trying to override any keyboard handlers that the component is using would be tricky and fragile.
I want to set focus on a button while caret is present in textbox and user can still enter data to textbox. But when user presses enter key, button press will be simulated.
I am currently using a work around to solve this problem by handling onKeyDown event and checking for enter key. But problem is there is no clue for user to understand this as there is not blue border around the button that indicates focus on button.
Here is a example of what I want to implement (user can enter text in textbox while focus is on :
I have tried to search on google and StackOverflow but could not find any relevant result.
This is a fundamental Windows principle. It's not possible to have 2 controls (windows) focused at the same time.
So the focus should be inside the text box. But you can get the visual indication needed by setting the ok button as AcceptButton of the form (you might also want to set cancel button as CancelButton).
In the form constructor, load event or using designer:
this.AcceptButton = okButton;
There is no need to handle KeyDown event - as soon as the text box is not multiline, pressing Enter while the focus is inside it will generate ok button click. The same applies for the button set as CancelButton when you press ESC.
Using CodenameOne,
I have a Form that the user needs to fill in. All of the components, however, are actually Containers that represent custom functionality. As an example, I would have a TextField alongside a Button on a Container, and I would use that Container as a "Component". This allows me to create more advanced functionality by combining existing Components.
A good example of where this is necessary is that of a custom date entry field existing out of 3 TextFields or a combination of TextFields and ComboBoxes.
I have a "Field" that has functionality for that of a Contact Component.
This all serves as a single "Unit" in order to allow the user to choose a contact or fill in their own. Buttons open Dialog popups, etc.
My problems comes with when the user uses the Android keyboard. Should this Contact Object be the second "Field" and the user presses the 'Next' button on the Android keyboard, the App does not know what field to give focus.
Furthermore, If one of the fields are a ComboBox or a Button and the user presses next to reach that Component, the keyboard doesn't close, and instead removes the 'Next' button, replacing it with a return button or an emoticon selector.
Below is an example situation:
The user would press on the first field, the Keyboard shows up, and when the user presses next, the keyboard's Next button dissapears, as the immediate next field happens to be a Button or ComboBox.
Is there a way to change the focusing index, or omit certain fields form ever gaining focus in this way? I tried making the entire thing a Component but that doesnt allow me to combine other Components. Even if it is possible to make the parent Container a Component, how would I solve this particular issue?
The default behavior is to use the "next focus down" for this functionality so just use setNextFocusDown(nextTextField) on each one of the components. Notice that a ComboBox won't work as expected although you might want to change that to an AutoCompleteTextField which would.
I am able to edit month,date and year by using TAB or Arrow keys(MM-dd-yyyy). I have doubt is this possible to edit total date format at a time (not using tab key or any arrow keys).
No, I don't think this is possible. From Using the DateTimePicker Control
The DateTimePicker operates as a masked edit control for entering date and time values. Each part of the date or time is treated as a separate field within the edit portion of the control. As the user clicks on each field, it is highlighted and they can use the up and down arrow keys to increment or decrement the value of the field. The user can also type values directly into the control, where applicable.
I am using EditorGridPanel with cellEditor which acts nearly like Excel. We implemented Arrow Keys to move among rows and columns.While validating a row, if it does not match the validation rule we show a MessageBox and hope that focus does not move if it is not valid. But, after the MessageBox shows - focus moves to the next row/column. Another problem is, user have to click in the OK button of the MessageBox to remove that from screen. Can we have the focus on the invalid column editor and also focus on the MessageBox OK button - so that user can press Enter to hide the message and continue entry?
Please check our link. http://www.softworksbd.com/swazilandlmis/yyyy_stockdata.php
Only one element can be focused, so focus should go to the message box. AFAIK enter/escape keys works out of box with message box.
You can pass callback to the messagebox. In this callback you can focus desired cell in the grid. Like this:
Ext.Msg.alert('Title', 'Message.', function(){
this.startEditing(rowIndex, colIndex);
}.createDelegate(grid));
So after message box is closed, the focus will go back to the editor.