I am working on a UWP app that has a view which is, sort of, like excel. The user can input data on text fields, which are inside a ListView. Upon scrolling, more items are added in the ListView and hence more textboxes come into play.
The problem that I am facing with this is that the typing on these textboxes has a lot of lag. I was using caliburn micro mvvm framework and thought it is slowing down the app (which it was, the navigation mostly) so I removed it but there is no effect on the typing lag.
Does anyone have experience with this?
You are calling code in TextChanging- this will fire every time a user enters or deletes a character from the TextBox. Not good. Unfortunately TextChanged will also do the same thing.
You want to fire your code when the user hits the enter key on KeyUp
https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.uielement.keyup
private void myTextbox_KeyUp(object sender, KeyRoutedEventArgs e)
{
if (e.Key == VirtualKey.Enter)
{
// the user has pressed enter and is done entering text, do something here
}
}
Related
We are working on xamarin.ios app. Here we have design two different view one for portrait and another is landscape view in asingle view controller. Both view have a text field. We are loading view according to device orientation. Everything is good but when we start typing in text field, Keyboard up and auto dismiss while we type a very fist character. Again we focus on text field, keyboard appear but dismiss when we press any letter.
One thing that I have noticed, When we tap on keyboard key “ViewDidLayoutSubviews()” event call and view reloaded.
Can you please guide me to solve this issue.
From what I can tell you are probably calling an event driven function when the text field is updated in such a way that it dismisses the keyboard? If this assumption is right, make sure that you are only adding the event to the text field once. Also make sure that the event you are calling isn't updating after every key stroke. You may need to use the event textbox.EditingDidEnd to run whatever function you want as soon as the user is no longer typing into the text field. I can update the answer with more specifics if i can see the actual code.
We have solved it logically by using flags. We have declare a boolean flag isKeyboardAppear=false when view appear first. When keyboard appear we set this flag to true And we noticed ViewDidLayoutSubviews() method are calling on every key press, so we write this code
public override void ViewDidLayoutSubviews()
{
base.ViewDidLayoutSubviews();
if (isKeyboardAppear == true)
{
return;
}
}
When we hide keyboard manually we reset flag isKeyboardAppear=false .
In my application I have a multi step form wizard in which
the next button is disabled unless all the required fields are entered.
Some fields require extra validation such as the directory picker,
for which I have to check whether the directory exists or not.
To ease the user experience I need to show an "Invalid directory" tooltip
next to the directory text field.
I would like to show the tooltips when the user tries to click/enter the disabled
next button.
Is it possible to capture events performed on a disabled button in JavaFX?
public void nextEntered(Event event) {
Button button = (Button)event.getSource();
if(button.isDisabled()){
validate(currentTab);
}
}
I had a similar problem where I wanted to show a tooltip of a disabled field's value when the user moused over that disabled field.
I ended up putting a blank label over the disabled field and attaching a mouse event to that.
In the case of a button, you can just give the dummy label mouse transparency when the button becomes enabled so the user can click the button.
(You might even be able to bind the label's mouse transparency property to the button's enabled property but I'm not sure.)
I know this was asked a year ago but maybe it will help someone else.
Ok I write Windows Phone 7.5 application in which I have several textboxes in a single page.
I made a ScrollViewer and inside I have a Grid and the textBoxes are inside the Grid.
I want to make it so that when I press enter keyboard button in the textbox I will focus on the next textBox.
So I made events in which I check whether enter button is clicked and if it is I focus on the next element, but when I focus on textBox which is even lower than the normal window and you have to scroll down to see it, it actually focuses on it but doesn't displays it and the screen stays on the last marked textbox.
Is there a way to fix that? Here is how I do it:
private void txtUsername_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
txtPassword.Focus();
}
}
I need to fire a method when a figure is selected in GEF diagram.
addSelectionChangedListener works well when I select a figure, but if i click on the same figure again ("unselect") the listener doesn't fire.
How can i fix it?
final GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
//Fired when figure is selected, but not when same figure is selected again
}
});
I don't think you can implement a toggling behaviour for a GEF figure through the selection mechanism. The selectionChanged event gets fired when the selection changes, so clicking twice on the same figure is not going to make it.
Maybe a different approach is needed taking into consideration that a figure is deselected when another figure gets selected and that you can retrieve the that element from the SelectionChangedEvent object passed in.
Also, you should only care about the user selecting a figure within the diagram and not a different element from any other workbench part.
I am using a button and a listview to display a list of options to the user. Selection is made with a mouse click, the listview removes its self from the .Controls array + un-registers eventlistener and loads a new listview else where on the screen.
My problem is both listviews trigger e.selected twice:
' private void _lvKids_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
if (e.IsSelected)//fires twice per click
{
HideKidsList();//--REMOVE CURRENT LISTVIEW
ValidateUser();//CREATE NEW LISTVIEW
}`
If the button is clicked a second time to restart the process, it causes a win32 Exception. After much research, this exception is the often the cause of a memory leak. So I'm thinking memory leak?
When I first started, listboxes were used which worked perfectly. I'd love to able to use them, but my form has a graphic for a background and listbox doesn't. Listview does.
I don't have anyone to turn to so any thing you can offer would be appreciated.
Thanks;
Sam
An update if anyone else has the same issue. Selecting the listview item called for it to be removed from Controls array. Removing the listview also cause the selected item to be deselected, thus 4 calls to the handler.