Results 1 to 13 of 13
  1. #1
    deepaksharma is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Jul 2023
    Location
    india
    Posts
    389

    how can get focus with right and left arrow keys.

    My greetings to all of you,

    I have created a dashboard by setting all the buttons in 2 rows as per the attached picture. The buttons on the first row are visible while the buttons on the second row are invisible.

    I want that as per the attached picture on the first row, when the right arrow key is pressed on the Skype button, the button on the second row becomes visible and gets focus, similarly when the left arrow key is pressed on the second row So that button disappears and the button on the first row becomes Get Focus.
    Please tell which coding will be done for this in which event.

    Thank you.
    Attached Thumbnails Attached Thumbnails righUntitled.png   lefUntitled.png  

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I don’t see a second row becoming visible, I see a separate control - might be a listbox or subform

  3. #3
    deepaksharma is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Jul 2023
    Location
    india
    Posts
    389
    Quote Originally Posted by CJ_London View Post
    I don’t see a second row becoming visible, I see a separate control - might be a listbox or subform
    I have put this as an example

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    an example of what? - it is not demonstrating a second row. Seems like you want to know how to design a bus, but show an image of a train as an illustration.

    if you want as per what you have shown, you need two tables - programs and tasks with a one to many relationship between them. Then have a form with two subfroms, the first to show programs, the second to show tasks, plus a hidden control to capture the currently selected program and use the linkchild/master properties of the tasks subform based on the the programFK in the tasks table (child) and the master - the name of the hidden control.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Based on a look at a recent db posted by OP my guess is that what is wanted is a fly-out menu when you use the right arrow key. The "example" is one from Windows.
    Last edited by Micron; 12-28-2023 at 12:50 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    That’s the problem - we’re guessing

  7. #7
    deepaksharma is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Jul 2023
    Location
    india
    Posts
    389
    You all are very welcome.
    You understood it right. In the database that I had uploaded earlier, I had to focus on a list box with the arrow keys and go up and down on all the options in the list box. When even after a lot of efforts, I did not get success in it, then I used the other option on the right side. I have created buttons which become visible by clicking on add master button. Now I want to get focus on those visible buttons with right arrow key. Please see the attached file and guide me properly. Thanks.
    Attached Files Attached Files

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I don't see any code you say you tried

    And I don't understand what you are trying to do. If the user has to use the mouse to to click on a button, why then make them use the keyboard to navigate to the newly visible options, when they can just click on the required one?

  9. #9
    deepaksharma is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Jul 2023
    Location
    india
    Posts
    389
    Quote Originally Posted by CJ_London View Post
    I don't see any code you say you tried

    And I don't understand what you are trying to do. If the user has to use the mouse to to click on a button, why then make them use the keyboard to navigate to the newly visible options, when they can just click on the required one?
    Oh sorry CJ_London, looks like I made a mistake.

    I have made changes to the file and uploaded it again.

    Actually, I want that when the user goes to the Add Master button and presses the right arrow key, all five buttons A B C D and E should appear and should be "set focus" on the A button.
    And if the user presses the left arrow key on the A button, all five buttons A B C D and E should disappear and should be "set focus" on the Add Master button.

    Thank You.
    Attached Files Attached Files

  10. #10
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you'll need some code to loop through the controls to show or hide them e.g.

    dim i as integer
    for i=1 to 5
    me("co" & i).visible= not me("co" & i).visible
    next i
    use the same looping to change the captions if that is what is required

    Use the keydown event to move between controls by changing focus using the up/down/left/right keys

    the keycodes are
    37 left
    38 up
    39 right
    40 down

    All code will need to be applied to all buttons. You could create a standard function to save some coding but would still need to be called from each button keydown event since you will need to supply the keycode value.

  11. #11
    deepaksharma is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Jul 2023
    Location
    india
    Posts
    389
    Quote Originally Posted by CJ_London View Post
    you'll need some code to loop through the controls to show or hide them e.g.
    Thank you very much Cj_London
    I have not run the loop in it but have made all the changes as per your suggestion and have also created three functions, now it is working properly. If I am making any mistake, please guide me by checking the attached file.
    Thank you.
    Attached Files Attached Files

  12. #12
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    If it is working as you require then what is there to check? The people you should be asking is the people who will be using it- does it work as they expect?

  13. #13
    deepaksharma is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Jul 2023
    Location
    india
    Posts
    389
    yes cJ
    thank You Very much.........

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 05-18-2016, 03:27 PM
  2. Need to detect right arrow key
    By ChuckColeman1812 in forum Programming
    Replies: 4
    Last Post: 09-12-2012, 08:08 AM
  3. issues with Enter/Tab/arrow keys clearing fields
    By Kimberly42506 in forum Access
    Replies: 10
    Last Post: 12-16-2011, 03:32 PM
  4. Replies: 0
    Last Post: 11-21-2011, 01:33 PM
  5. Replies: 3
    Last Post: 02-02-2011, 01:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums