VirtualKeyboard Set Text (1 Viewer)

celesta

Portal Member
February 7, 2011
46
2
Hello,

I want to show a virtual keyboard and set for text a filename to edit it.

When the Virtual keyboard is show:
- the filename is set
- the cursor is at the last character
- then the user type a character, it's set at the end of the text

There is the vb.net code I used:
Dim DLG_VirtualKeyboard As VirtualKeyboard

DLG_VirtualKeyboard = GUIWindowManager.GetWindow(GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD)
DLG_VirtualKeyboard.Reset()
DLG_VirtualKeyboard.Text = filename
DLG_VirtualKeyboard.DoModal(GUIWindowManager.ActiveWindow)

Result:
The virtualkeyboard is show but the text isn't set.
I see a lot of example but I don't know what is wrong

Thanks in advance
 

Seidelin

Retired Team Member
  • Premium Supporter
  • August 14, 2006
    1,755
    652
    Kgs. Lyngby
    Home Country
    Denmark Denmark
    Take a look in TVSearch.cs under TVplugin. For some reason the tv search by default starts with an "A" entered already. Maybe this can help you.
     

    celesta

    Portal Member
    February 7, 2011
    46
    2
    I do the same as TVSearch.cs :

    VirtualKeyboard keyboard = (VirtualKeyboard) GUIWindowManager.GetWindow((int) Window.WINDOW_VIRTUAL_KEYBOARD);
    if (null == keyboard)
    {
    return;
    }
    string searchterm = string.Empty;
    keyboard.Reset();
    keyboard.Text = filterLetter;
    keyboard.DoModal(GetID); // show it...


    Maybe there is a bug with MP1.2 Alpha . I'll wait for the 1.2 Beta to see if it work.

    Thx
     

    thlucas

    Portal Pro
    February 11, 2011
    133
    146
    Omaha, NE
    Home Country
    United States of America United States of America
    I am curious about this functionality as well for MP versions prior to v1.2.0.

    If developing for MP v1.2.0 and above, you can use the "SetLabelAsInitialText" method and the "Label" property to set the initial value - note that this is only supported under MP v1.2.0 and above though. This method and property do not exist prior to v1.2.0, and will generate compiler errors if you try to use them in prior versions.

    I think it's kinda weird that they have the "SetLabelAsInitialText" method - why not just display whatever is set in the "Label" property as the initial text? Why the extra line of code to the method?

    Note that it still does not solve the "text-at-end" problem. ie when I start typing, it wipes out the original entry and replaces it with the characters entered. Here's the code I used.

    Code:
                    // display virtual keyboard.
                    // MPVersion Compatibility notes:
                    // - VirtualKeyboard SetLabelAsInitialText method is not supported prior to v1.2.0.0!
                    // - VirtualKeyboard Label property is not supported prior to v1.2.0.0!
                    VirtualKeyboard kbd = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                    kbd.Reset();
                    kbd.Label = "My Initial Text";
                    kbd.SetLabelAsInitialText();
                    kbd.DoModal(this.GetID);
     

    celesta

    Portal Member
    February 7, 2011
    46
    2
    I confirm what it was a bug in mediaportal 1.2 Alpha.

    In mediaportal 1.2 Beta all are working.

    Thanks!
     

    Users who are viewing this thread

    Top Bottom