In .Net Maui I am using an Editor view. I am also using codebehind as it is convenient for what I'm doing.
There is a Completed event. However, this is raised by: quote
The Completed event is raised when the user has ended input by pressing the return key on the keyboard, or by pressing the Tab key on Windows.
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/editor
On Android Pixel 5 emulator the keyboard comes up
enter image description here
The return key causes a newline on the Editor viewport which is actually what I want, so how do I complete the action and raise my completed event?
I must be missing something very obvious here?
Code XAML
<Editor Grid.Row="1"
x:Name="SurveyCodes"
FontSize="20"
TextColor="Yellow"
Placeholder="Enter survey codes"
Completed="SurveyCodesCompleted"
TextTransform="Uppercase"
Keyboard="Default"/>
and code behind
private void SurveyCodesCompleted(object sender, EventArgs e)
{
...
}
Update:
Thanks for your feedback and support.
There is a known issue about this problem.
You can follow it up here: https://github.com/dotnet/maui/issues/5730 .
Related
I am newbie to MFC. I have a native C++ MFC app. I want to show a dialog from main dialog. In the main dialog I am having three button (Back, Next, Cancel) respectively.
On the Next button click event I am calling DoModal to show another dialog by hiding the main dialog as follows,
void CFirstPage::OnBnNextButton()
{
::ShowWindow(this->GetSafeHwnd(),SW_HIDE);
CSecondPage secondDlg;
secondDlg.DoModal();
}
void CSecondPage::OnBnBackBtnClicked()
{
::ShowWindow(this->GetSafeHwnd(),SW_HIDE);
CFirstPage FirstPage;
FirstPage.DoModal();
}
After executing this code snippet, the main dialog got hidden and even the application icon also disappears from the taskbar and again appears when the other dialog pops up.
(Basically I am having the same icon for both the dialogs, the icon should not get disappeared and appear again. It has to remain same without appearing and disappearing .)
How can show the icon in the taskbar without any flickering effect?
During traversing from back to next in middle I clicked cancel and the Cancel event is handled as follows,
void CFirstPage::OnCancel()
{
CDialog::EndDialog(TRUE);//For closing the dialog.
}
void CSecondPage::OnCancel()
{
CDialog::EndDialog(TRUE);//For closing the dialog.
}
Steps1:Click Next in the main dialog
Step2: Click Cancel in the second page
Now the application closes. But still instance is active in the "TaskManager". As per my understanding no instance should be alive once windows is closed ?
I suspect as the first dialog is only hidden not ended that instance is still existing in the TaskManager. Is this understanding correct?
How can I resolve this issue?
Can anyone kindly help me to resolve this issue.
As said by Iinspectable property sheets are best suited for your your problem statement.A very good example on how to use CPropertysheets can be found in codeproject
CProperty sheet example
Probably your main windows is still hidden after you end dialog with second page. Ending dialog of CSecondPage does not close application only closes active CSecondPage dialog.
Also OnCancel/OnOK does not need to be overriden if you just EndDialog with it. There is default behaviour implemented in OnCancel, which will close the dialog.
After secondPage.DoModal() show your main dialog again, or close it if that is the behaviour you want to achieve.
FirstPage isn't the original first dialog now, so you should store the first dialog object by yourself. You can do that like this:
void CFirstPage::OnBnNextButton()
{
::ShowWindow(this->GetSafeHwnd(),SW_HIDE);
CSecondPage secondDlg;
secondDlg.setFirstDialog(this); //customer function to store first dialig object
secondDlg.DoModal();
}
void CSecondPage::OnBnBackBtnClicked()
{
::ShowWindow(this->GetSafeHwnd(),SW_HIDE);
::ShowWindow(m_firstDialog->GetSafeHwnd(), SW_SHOW);
}
A user of one of my apps said that he was "expecting" the Enter key to move between the Textboxes. Is there a way to do that with the Windows Phone?
See you can set the TabIndex of each control but do I have to write a lot of code to capture the onKeyDown?
Just wondering if there is an easy way to add this feature.
One decent options is, by implementing logic to move between Textboxes as Custom Behavior. Like done by Mike Hole as written in his blog. With Mike's custom behavior, we can simply attach that behavior to the textbox and specify control name to move focus to upon enter key pressed :
<TextBox x:Name="txtUsername">
<i:Interaction.Behaviors>
<mh:OnEnter NextControlName="txtPassword" />
</i:Interaction.Behaviors>
</TextBox>
I would like to create an info message box in Windows Phone.
It should look like a single text message, that's shown on screen for X seconds, and I doesn't have any confirmation buttons
as MessageBox.Show() does. It would be used to show user some messages about the app progress, like "file download started",
or "preferences saved".
I've tried to create something like that, using Popup element, but it seems a bit different of what I want to
make.
With the popup I can create something like that
canvas.MouseLeftButtonUp += new MouseButtonEventHandler(popupCloseEvent);
For example, which closes this popup when user taps it.
or something similar. (Maybe can implement a timer there to close it after a few secs)
Are there better ways to create such thing?
You could use the either the Message Dialog or Overlay controls in the Coding4Fun toolkit.
Found here: http://coding4fun.codeplex.com/
They are really simple and easy to use controls.
Try this
In Xaml:
<Popup Tap="Popup_Tap"></Popup>
In code behind:
private void Popup_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
(sender as Popup).IsOpen = false;
}
I hope it helps.
Is it possible to not show system keyboard, when you tap textbox? Ive created custom keyboard and can work with textblock only, because of this i cant delete just parts of sentence.
If you set IsReadOnly to true then the user can still select the text in a TextBox to copy paste and the OS doesn't show the software input keyboard when selected. You can still alter the contents of the TextBox through code though. Eg;
<TextBox x:Name="ExampleTextBox"
IsReadOnly="True"
Text="Initial Content"
GotFocus="ExampleTextBox_GotFocus"
/>
And in your code behind;
private void ExampleTextBox_GotFocus(object sender, System.Windows.RoutedEventArgs e) {
ExampleTextBox.Text += " ... focused!";
}
Would prevent the user from entering text via the software keyboard but will append "... focused" everytime they give focus to the TextBox. Contrived example, but you get the idea.
The only other thing I'd suggest is to re-style the TextBox. By default when IsReadOnly is set the TextBox will provide visual cues that it can't be modified by the user. Which isn't the case here.
if the user touches the keyboard, the keyboard will get focus.
the only option you as a developer have is to catch it and call this.focus moving focus away from textbox.
This will however mean that there will be a flicker where default keyboard pops up and is hidden.
I know this because i have a keyboard app. There is no other way.
I'm using c++/cli with visual studio 2010 express edition.
What I want to do is create a panel that is invisible but that still accepts/receives the click and double click messages and possibly other mouse input. If I set the controls visibility to FALSE then this seems to disable any mouse input.
I have tried getting the paint message and doing nothing (as was suggested by other sources) to try and make the panel simply not draw but not be invisible however the panel still seems to be drawing.
What should I be doing in the paint message to tell windows that I have draw the panel?
My panel drawing function is:
private: System::Void panel1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
}
If there are any other suggestions about how I could achieve this then that would be helpful.
In the end I scrapped this idea all together, the problem was to get a way of getting the mouse input from a window that had been "parentented" by a NativeWindow class. This meant that the window I was expecting to receive messages (the child window) was not receiving the messages.
In order to get the messages you need to override the event handler in your parent NativeWindow class. Here you can handle the event This is where I got the solution:
http://msdn.microsoft.com/en-us/library/system.windows.forms.nativewindow.createhandle.aspx