10 Replies Latest reply: May 12, 2009 2:37 AM by 843851 RSS

    Hsinglelineentry is not working

      dear all,
      i am using Xletview 0.3.6 as an emulator and i wanted to have a text input so i used the component HSingleLineEntry the problem is that although it have the focus nothing is inserted when i click on the remote control can some help me and tell me how to insert text not only numbers
      my code:
      HSinglelineEntry textInput = new HSinglelineEntry(10, 10, 400, 300);
                textInput.setFont(new Font("Tiresias",Font.PLAIN,20));
                try {
                     textInput.setLook(new HSinglelineEntryLook());
                } catch (HInvalidLookException e) {
                     // TODO Auto-generated catch block
                //textInput.setTextContent("some text", textInput.ALL_STATES);
                HTextEvent startEvent = new HTextEvent(textInput,HTextEvent.TEXT_START_CHANGE);
      another question i didn't find any open sources Java TV or MHP applications even basic ones can someone guide where i can find some
        • 1. Re: Hsinglelineentry is not working
          Hi, have you set      setEditMode like this:
          • 2. Re: Hsinglelineentry is not working
            Setting editMode doesn't helps.
            • 3. Re: Hsinglelineentry is not working
              As far as I know, you have to push enter button when the text entry component is focused, to edit it, but to avoid this if you could set the edit mode to true when the input component is in focused state (addFocuslListener and OnFocusGain--> textEditMode=true). Althougt doing this I found another problem, which is that when you are writing some text in an input the arrow buttons doesn't function (the correspondent event is not thrown), to move from one to another component, untill you presh EXIT.

              I hope it will help you.

              • 4. Re: Hsinglelineentry is not working
                hi apenz,

                Would u please share some code example ? when i use Hsinglelineentry in xlet viewer, same problem.. :( can get focus, but cannot edit:(
                • 5. Re: Hsinglelineentry is not working
                  When you have the focus in a HSingleEntry you have to push OK button of your remote control to write inside it.
                  I paste here some code that could be helpful:

                  I define some variables related to the textbox (HSingleEntry) in the class that extends HComponent where will be added:
                       private HSinglelineEntry nameTextBox;
                       private  float nameTextBoxFx=0.2f;
                       private  float nameTextBoxFy=0.20f;
                       private  float nameTextBoxWidth=0.2f;
                       private  float nameTextBoxHeight=0.07f;
                       private final DVBColor nameTextBoxBackColor=new DVBColor(255,255,255,255);//100
                       private final DVBColor nameTextBoxForeColor=new DVBColor(0,0,0,255);//150
                  then I create the component and I add it to the window
                            nameTextBox=new HSinglelineEntry();
                  • 6. Re: Hsinglelineentry is not working
                    HI apenz,

                    thanks for the reply:)

                    Got another question need ur expertise.... when I am using alticast's STB, i notice for HGraphicButton, pressing VK_ENTER when it is in Focused state, it seems no event will be fired to KeyListener registered on that HGraphicButton ? but when pressing other keys, the keyEvent can be received... any idea?

                    My first draft of code,

                    new KeyListener(){
                    public void keyPressed (KeyEvent key){
                    -----output debug message here

                    after i did not get keyEvent when pressing Enter, I change the inner class to ,

                    Class A implements KeyListener{

                    public void keyPressed (KeyEvent key){
                    -----output debug message here


                    when pressing ENTER, still no debug message printed out... but if I click keys like "1", "2".... the debug msg will be printed out...

                    So does it mean that VK_ENTER will not be fired? thanks:)
                    • 7. Re: Hsinglelineentry is not working
                      The event to listen when you press a button is a HActionEvent, so you have to implement a HActionListener class.
                      you're welcome

                      Edited by: apenz on May 7, 2009 9:57 AM
                      • 8. Re: Hsinglelineentry is not working
                        thanks apenz
                        • 9. Re: Hsinglelineentry is not working
                          Hi apenz,

                          Currently I want to have a scrolling HGraphicButton list... but seems my HGraphicButton does not respond to any key event, but only respond to action event, (even I add a keyListener to the HGraphicButton, no key event fired when pressing keys like left and right).... so when a HGraphicButton is with focus, I cannot distinguish from left key pressed and right key pressed? any idea? thanks.
                          • 10. Re: Hsinglelineentry is not working
                            Hi nedved.yang,

                            In your focusListener function you just have to check the name of the component which generated this event:
                            HComponent focusedComponent=(HComponent)evt.getComponent();
                            And to catch general user key inputs you have to create a
                                      arrowAndNumberKeyEvents=new UserEventRepository("Arrow ");
                            and then add the HComponent element itself as listener
                                      EventManager.getInstance().addUserEventListener(this, arrowAndNumberKeyEvents);
                            Implementing UserEventListener functions
                                 public void userEventReceived(UserEvent evt) {
                                      HKeyEvent action=new HKeyEvent(this, evt.getType(),evt.getWhen(),evt.getModifiers(),evt.getCode(),evt.getKeyChar());
                                      case HKeyEvent.KEY_PRESSED:
                                           Logger.debug(this,"Pressed key= "+action.getKeyChar());
                                           for(int i=0;i<keyListeners.size();i++){
                                      case HKeyEvent.KEY_RELEASED:
                                           for(int i=0;i<keyListeners.size();i++){
                                      case HKeyEvent.KEY_TYPED:
                                           for(int i=0;i<keyListeners.size();i++){
                            Then in the HKeyListener function keyPressed implement what to do for each pressed button