This is a migrated thread and some comments may be shown as answers.

Cursor position

6 Answers 142 Views
InputPrompt
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Romasz
Top achievements
Rank 1
Romasz asked on 08 Dec 2013, 01:10 PM

Hello,


    I'm looking for an option to set the cursor position at the end of initial text (I set it with Setter(RadTextBox.TextProperty). Is it possible? I know that the user can click at the end, but it would be a nice feature.



   Taking an opportunity I will ask also if there is a possibility to show inputprompt without any button? The user will confirm only with keyDownHandler.



    Thank you,

       Tomasz

6 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 09 Dec 2013, 04:13 PM
Hello Tomasz,
Thank you for contacting us. Could you please send us a sample project demonstrating what you're trying to achieve? This way we would be able to assist you better.

Regards,
Kiril Stanoev
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Romasz
Top achievements
Rank 1
answered on 09 Dec 2013, 04:32 PM

Hello Kiril and thank you for reply.

Here is sample code:

Style titleStyle.Setters.Add(new Setter(RadTextBox.TextProperty, "Sample Title"));
InputPromptClosedEventArgs result = await RadInputPrompt.ShowAsync(new string[] { "Yes", "No" }, title: "Enter title",  
                   message: "Please enter a title:", isCheckBoxChecked: true, checkBoxContent: null, inputMode: InputMode.Text,
                   inputStyle: titleStyle, vibrate: false, horizontalAlignment: System.Windows.HorizontalAlignment.Stretch,
                   verticalAlignment: System.Windows.VerticalAlignment.Top, 
                   keyDownHandler: (keyArgs) => { if (keyArgs.Key == Key.Enter)  RadInputPrompt.Close(0); });
Now when the user begins to ener a title, the cursor blinks at the beginning of the provided text, is it possible that the user starts entering at the end?



Normally in TextBox as I remember we can use Select to achieve that.



The Second question is if I can make this promptBox above without any button (Ok) - the user will accept with key.Enter and cancel with back button.



0
Kiril Stanoev
Telerik team
answered on 10 Dec 2013, 09:40 AM
Hi Tomasz,
Thank you for the clarification. Unfortunately there's no easy way to achieve what you're looking for. One suggestion though. Would it help your scenario if you set a Watermark instead of a Text:

titleStyle.Setters.Add(new Setter(RadTextBox.WatermarkProperty, "Sample Title"));

...or you insist of using the Text property?

Let me know what you think. I'd be glad to assist you further.

Regards,
Kiril Stanoev
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Romasz
Top achievements
Rank 1
answered on 10 Dec 2013, 10:25 AM

Hi Kiril,

Unforutunately watermark won't be sufficient because when you receive args at the return, with watermark if user entered nothing, you get null or "" and with textProperty you get the text you provided. For example imagine, that I've user name and I want him to add his age at the end in the prompt box. Ok, It would be nice, but it's not so important. Think about providing a method to set a cursor position, it shouldn't be hard for you to implement such a one.

The second problem (with no buton) I've managed to solve myself.

There is also a thing you can improve - In the code above when I hit enter, the box closes, but the keyboard remains on the screen for a while. Is there a code which I should add to replicate the exact behaviour of clicking "yes" button in prompt box - close keyboard, bring page to front (it's a little darker for a while)? I manager to get rid off the keyboard with this.Focus() but I still don't know how the darkening is realized.



        Thank you, Tomasz







0
Accepted
Kiril Stanoev
Telerik team
answered on 13 Dec 2013, 08:42 AM
Hello Tomasz,
To workaround the cursor issue, please refer to the attached project.
As for your second question, I was unable to reproduce the issue. The keyboard always hid whenever I pressed Enter. Please take a look at this video and let me know if I am missing anything.

Regards,
Kiril Stanoev
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Romasz
Top achievements
Rank 1
answered on 13 Dec 2013, 11:34 AM

Hello Kiril,

    Thank you very much for the provided code - works perfect and it helps me a lot.

As for the second issue, I've tried to reproduce the situation on your code, but I've failed - which means that I've probably screwed something up in my code. I'll check it, and if I'm able to reproduce the situation I'll provide that code.

   Regards,

       Tomasz

Tags
InputPrompt
Asked by
Romasz
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Romasz
Top achievements
Rank 1
Share this question
or