How to modify File menu width
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: How to modify File menu width

  1. #1
    Join Date
    May 2002
    Location
    Romania
    Posts
    928

    How to modify File menu width

    Hello,

    I derived a class from CRecentFileList in order to set the number of displayed chars for MRU.
    The problem is that if I open the app with 256 set for this number (it is read from .ini file) the display is correct. But after I change it to 10 for e.g., File menu width remains unchanged altghough MRU are correctly displayed on 10 (or at least file name lenghts) chars.

    Have you any ideea how can I tell to the menu to shrink to actual width?

    Thank you,
    Move like a snake, think like a snake, be a snake !!!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,291

    Re: How to modify File menu width

    Perhaps, DrawMenuBar could help?
    Victor Nijegorodov

  3. #3
    Join Date
    May 2002
    Location
    Romania
    Posts
    928

    Re: How to modify File menu width

    I've already tried it, no use.
    Move like a snake, think like a snake, be a snake !!!

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,291

    Re: How to modify File menu width

    Then try to reload menu (CFrameWnd::OnUpdateFrameMenu followed by DrawMenuBar)
    Victor Nijegorodov

  5. #5
    Join Date
    May 2002
    Location
    Romania
    Posts
    928

    Re: How to modify File menu width

    I tried this as you adviced me and still no effect.
    Can anyone tell me where is the place the system computes necessary width in order for accelerators to be also displayed?
    I think knowing this I will be able to accomplish my update.
    Move like a snake, think like a snake, be a snake !!!

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,291

    Re: How to modify File menu width

    Quote Originally Posted by Snakekaa View Post
    I tried this as you adviced me and still no effect.
    How have you implemented it? Could you show your code?

    Quote Originally Posted by Snakekaa View Post
    Can anyone tell me where is the place the system computes necessary width in order for accelerators to be also displayed?
    I think knowing this I will be able to accomplish my update.
    I guess it is calculated in menu draw procedure. Sure you could override it using owner draw menu.
    Victor Nijegorodov

  7. #7
    Join Date
    May 2002
    Location
    Romania
    Posts
    928

    Re: How to modify File menu width

    Where can I find that menu draw procedure?
    To override menu for this issue is just too much.
    Perhaps I can do it without overriding?
    Move like a snake, think like a snake, be a snake !!!

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,291

    Re: How to modify File menu width

    Did you try to completely replace menu? Like it was described in KB How to Use Multiple Menus in MFC App That Uses GetDefaultMenu...
    Victor Nijegorodov

  9. #9
    Join Date
    May 2002
    Location
    Romania
    Posts
    928

    Re: How to modify File menu width

    I do not have another menu to replace with.
    I just want to tell this menu that I don't need that width anymore.
    I saw that this behaviour is the default one in Windows app, but I do not want it.
    Move like a snake, think like a snake, be a snake !!!

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,291

    Re: How to modify File menu width

    You do NOT need "another" menu. Just try to load the same menu and replace the existent one with the loaded one.
    Victor Nijegorodov

  11. #11
    Join Date
    May 2002
    Location
    Romania
    Posts
    928

    Re: How to modify File menu width

    Let suppose I do not have a document just open the app.
    I have a method attached to a menu ID which changed File options width.
    In that method I tried this:

    ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
    OnUpdateFrameMenu(NULL);
    DrawMenuBar();
    Perhaps IDR_MAINFRAME is not found or perhaps something else went wrong the fact is it didn't worked.
    Move like a snake, think like a snake, be a snake !!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center