Cursor position

7 posts, 1 answers
  1. Romasz
    Romasz avatar
    8 posts
    Member since:
    Dec 2013

    Posted 08 Dec 2013 Link to this post

    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

  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 09 Dec 2013 Link to this post

    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.
  3. DevCraft banner
  4. Romasz
    Romasz avatar
    8 posts
    Member since:
    Dec 2013

    Posted 09 Dec 2013 Link to this post

    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.



  5. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 10 Dec 2013 Link to this post

    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.
  6. Romasz
    Romasz avatar
    8 posts
    Member since:
    Dec 2013

    Posted 10 Dec 2013 Link to this post

    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







  7. Answer
    Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 13 Dec 2013 Link to this post

    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.
  8. Romasz
    Romasz avatar
    8 posts
    Member since:
    Dec 2013

    Posted 13 Dec 2013 Link to this post

    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

Back to Top
DevCraft banner