Results 1 to 8 of 8
  1. #1
    bilalo is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    107

    Combobox change width on click


    I have a combobox cmb, when the user clicks on it, I want to change its width, after the user selects a value, I want to change its width back to original width
    I managed to change its width on cmb_gotFocus and then change it back on cmb_Afterupdate
    So, now when the user clicks on cmb, the width changes, the problem is if he didn't select anything from the menu, for example he clicked on the arrow again without selecting anything, or he clicked outside cmb, the width won't change back to original because the After_Update is not triggered. I tried to use the Lost_Focus to change the width back, but it is also not triggering when the user doesn't select any item.

    Any idea how can I solve this issue?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    try using the control enter and exit events

  3. #3
    bilalo is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    107
    Quote Originally Posted by Ajax View Post
    try using the control enter and exit events
    Thank you, also an Afterupdate is still needed for changing the width after the user selects an item

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    What you're describing as a need is the normal behavior of a Combobox with multiple columns. What is your underlying need, here?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    bilalo is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    107
    Quote Originally Posted by Missinglinq View Post
    What you're describing as a need is the normal behavior of a Combobox with multiple columns. What is your underlying need, here?

    Linq ;0)>
    I have a combobox that needs to show data larger than its width, but I can not increase its width because there is no empty space for it. My screen is full of other controls.
    So I managed to increase its height, now when I select an item it is shown on three lines. However, the problem occurs during selection, the items are cropped since they are larger than the width, so I can not know full details about items i am selecting

    What I have done is to increase the combobox width on click (to show full item details) and then decrease it back after selecting an item (and here it will be wrapped on three lines).

    I don't know if I am missing something here, is there a simple way to show combobox items (larger than width) on multiline during dropdown?

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    In the property sheet for combos, there are two separate properties: Width and list width. The second of these is the width shown when the combo drop down is displayed. Make it wider than the width property so you see all the text.
    It doesn't matter if it cover other controls during selection as the width goes back to normal afterwards...automatically as Linq explained.
    You don't need the got focus or after update events for this.
    After selection, your issue has been solved by increasing the height.

    If still not happy, reduce your font size or move other controls on the form.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    bilalo is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    107
    Quote Originally Posted by isladogs View Post
    In the property sheet for combos, there are two separate properties: Width and list width. The second of these is the width shown when the combo drop down is displayed. Make it wider than the width property so you see all the text.
    It doesn't matter if it cover other controls during selection as the width goes back to normal afterwards...automatically as Linq explained.
    You don't need the got focus or after update events for this.
    After selection, your issue has been solved by increasing the height.

    If still not happy, reduce your font size or move other controls on the form.
    Oops, so it is that simple and I was trying every possible hard solution to solve it
    Thanks a lot.

  8. #8
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Glad you're happy now.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 0
    Last Post: 11-24-2015, 07:41 PM
  2. Change Width of a Drop Down Box?
    By kreelix in forum Access
    Replies: 1
    Last Post: 10-14-2015, 08:44 PM
  3. Replies: 4
    Last Post: 07-02-2014, 02:08 PM
  4. Change width of subform in code
    By GraeagleBill in forum Programming
    Replies: 2
    Last Post: 12-02-2012, 04:57 PM
  5. Change fields based on a combobox click
    By Richie27 in forum Programming
    Replies: 5
    Last Post: 05-31-2012, 08:01 AM

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