Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Can't get my list to getFocus()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Can't get my list to getFocus()

    Hi,

    I am working on Alpha v12.4.5.4.5, build 5221. I have a search text box that is then triggering a search in a list object on the KeyUp event of the box checking for the 'enter'. Inside the lists 'afterSearchComplete' event I have

    {dialog.object}.setFocus('LIST_CUSTS');

    The behaviour I want and am expecting is for the user then to be able to use the cursor keys to navigate through the list. This isn't happening and the focus is staying the the search text box. Can anyone shed some light on this please?

    Many thanks
    Georgina

    #2
    Re: Can't get my list to getFocus()

    First, look at your List Property "Capture focus". Ensure this is checked.

    If that property is enabled, it looks like this behaviour may be broken. .setFocus() specifically looks after Lists... in order to do just what you want to do... according to the doc. However, I'm not seeing any way to set focus to a List control.
    You should report this. If it's a bug, you should request a hotfix to correct build 5221 so that you don't have to move into the world of pre-releases.

    Comment


      #3
      Re: Can't get my list to getFocus()

      Finally figured it out! I knew it must have been possible because, of course, if you click in a row of the list, the "list" (well, actually the list.CONTROL hidden input field) gets focus. Also you can tab to the list to get focus.
      In any case, you have to be able to programmatically be able to do it or creating automated tests wouldn't be very useful except in simple cases.

      Anyway, what does getting "focus" mean? I suppose it could be at least these 3 things: triggering events on focus and then on blur, making the control look like it is in focus in the cases where you want it to, and watching/listening for other events.
      To address only the one you want, in the list event where you want, try this:

      Code:
      	{dialog.object}.setFocus('LIST_CUSTS');
      	var lObj = {dialog.object}.getControl('LIST_CUSTS'); 
      	lObj._keyWatch.on();
      But you'll have to turn it off with lObj._keyWatch.off(); at some point if you don't want it to interfere with other controls.

      Comment


        #4
        Re: Can't get my list to getFocus()

        Now that I know what I'm looking for....
        A much cleaner way:

        Code:
        	var lObj = {dialog.object}.getControl('LIST1');
        	lObj._focus('click');
        I don't think you'll break anything with this method versus a little mess you could make using my 1st suggestion.

        Comment


          #5
          Re: Can't get my list to getFocus()

          Originally posted by jgrannis View Post
          Now that I know what I'm looking for....
          A much cleaner way:

          Code:
          	var lObj = {dialog.object}.getControl('LIST1');
          	lObj._focus('click');
          I don't think you'll break anything with this method versus a little mess you could make using my 1st suggestion.
          Jeff... this is very cool... but... are you seeing the same behaviour I see when using your code? It does work... but even though focus is with the List Control (in that you can cursor through rows) focus is still actually with the search field. The cursor is still in the search field and typing anything goes into the search field.

          This is a nice workaround, but it seems like there is a bug in .setFocus() for the List Control.

          Comment


            #6
            Re: Can't get my list to getFocus()

            I hadn't seen it because I had used a button next to the textbox to fire off a client side filter and then had the above code in afterClientSideFilter.
            So I guess my button click outside the textbox made it a nice proper blur.

            Comment


              #7
              Re: Can't get my list to getFocus()

              I changed it in order to use the onKeyUp in the textbox.
              Before running my list filter code, I added:

              Code:
              var ele = {dialog.object}.getPointer('LIST1.CONTROL.FOCUSCATCHER');
              ele.focus();
              Seems to remove the cursor from the textbox. But unless I rushed through the tests and missed something, I still needed:

              Code:
              var lObj = {dialog.object}.getControl('LIST1');
              lObj._focus('click');

              Comment


                #8
                Re: Can't get my list to getFocus()

                That's much better... and it's probably what Alpha is missing in their .setFocus() for a List Control. I find I don't need the .getControl() stuff. Here's my full code that works... and looks... good. Nice sleuthing Jeff.

                Code:
                if(event.keyCode==13){
                	var searchValue = {dialog.Object}.getValue('txtSearch');
                	var lObj = {dialog.object}.getControl('list1');
                	lObj.filterListClientSide(searchValue);
                	var ele = {dialog.object}.getPointer('LIST1.CONTROL.FOCUSCATCHER');
                	ele.focus();
                }

                Comment


                  #9
                  Re: Can't get my list to getFocus()

                  Hi David and Jeff,

                  Thank you for your replies. I have got CaptureFocus checked on the list. I have taken what you have done and implemented it as below in the KEYUP event of the search text box and it still isn't working (the cursor is in the search text box and I can arrow up or down on the list). Any ideas please?

                  Code:
                  var keycode = event.keyCode;
                  
                  if (keycode == 13) //enter key
                  {
                           //this does the filtering
                  	{dialog.object}.buttonClick('BUTTON_LISTSEARCH_LIST_CUSTS');
                  }
                  if (keycode == 40) //arrow down
                  {
                  	var ele = {dialog.object}.getPointer('LIST_CUSTS.CONTROL.FOCUSCATCHER');
                  	ele.focus();
                  	var lObj = {dialog.object}.getControl('LIST_CUSTS');
                  	lObj._focus('click');
                  }
                  If not then I will alert Alpha to the issue and hope that they fix it at some point. The users will have to use their mouse instead of the keyboard.

                  Many thanks
                  Georgina

                  Comment


                    #10
                    Re: Can't get my list to getFocus()

                    There is a problem with .setFocus() and the List Control. You should report it.

                    Regardless, looking at your code it's unclear what your intention is. Your original post was about setting focus to the List Control using the onKeyUp event after an Enter. You've now introduced arrow down.

                    This works for me...

                    Code:
                    if (event.keyCode == 13) //enter key
                    {
                             //this calls a button click which does the filtering
                    	{dialog.object}.buttonClick('BUTTON_LISTSEARCH_LIST_CUSTS');
                    	var ele = {dialog.object}.getPointer('LIST_CUSTS.CONTROL.FOCUSCATCHER');
                    	ele.focus();
                    }

                    Comment


                      #11
                      Re: Can't get my list to getFocus()

                      My apologies, I added the second key press as I wondered if the delay of doing the search was causing the issue (in that it was running the command to get the focus before the list data has been returned). I have removed that code and have copied and pasted your code in. Sadly it still doesn't work. I must have something ticked somewhere that is stopping it from getting the focus.

                      Maybe the list has the focus and the issue is that I haven't got something set on the list to enable the movement up and down using the arrow keys. Is there such a setting?

                      Many thanks again for your assistance.
                      Georgina

                      Comment


                        #12
                        Re: Can't get my list to getFocus()

                        The only way to see what's going on is for you to post a sample UX.

                        Comment


                          #13
                          Re: Can't get my list to getFocus()

                          On my side, I was doing a client-side filter. With the server-side search getting fired before the list getting focus, I'm thinking that the response gets sent back to the client with information about the state of the UX before the focus change. That is to say, maybe the response includes information saying that the textbox is supposed to get focus after the update.

                          I think I would set the focus to the list's focuscatcher first then fire off the search by converting the code behind the button to a Javascript Action.
                          As in:

                          Code:
                          if (event.keyCode == 13) //enter key
                          {
                                  var ele = {dialog.object}.getPointer('LIST_CUSTS.CONTROL.FOCUSCATCHER');
                          	ele.focus();
                          
                                  {dialog.object}.runAction('LISTSEARCH_LIST_CUSTS');
                          
                                   //this calls a button click which does the filtering
                          	//{dialog.object}.buttonClick('BUTTON_LISTSEARCH_LIST_CUSTS');
                          
                          }
                          If you want to keep the button, have the button do the runAction() also.


                          EDIT: or just

                          Code:
                          if (event.keyCode == 13) //enter key
                          {
                                  {dialog.object}.runAction('LISTSEARCH_LIST_CUSTS');
                          
                          }
                          and then start your Javascript Action off with putting focus on the list's focuscatcher. That way, if you keep the button and let the user do either (start the search via hitting 'enter' or clicking the button) the list should get focus in both cases.


                          Another EDIT: or move the focuscatcher stuff to an event after the search is done...
                          And if you want to make sure that the list is configured correctly to be able to use the arrow keys once the list has focus, clicking on any row in the list or tabbing to the list should give it focus. Then using the arrow keys should confirm that all is good as far as that point is concerned.
                          Last edited by jgrannis; 09-11-2018, 12:50 PM.

                          Comment


                            #14
                            Re: Can't get my list to getFocus()

                            Thank you again for your help. Sadly it still isn't working. I have reported the issue to Alpha so hopefully it will be rectified soon. In the meantime the business has decided that they user can just use their mouse until this is fixed.

                            Georgina

                            Comment

                            Working...
                            X