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

Thread: [RESOLVED] Unwanted Toolbar Button

  1. #1
    Join Date
    Feb 2008
    Posts
    26

    [RESOLVED] Unwanted Toolbar Button

    This one's driving me nuts.

    I now have an unwanted, disabled button on my program's toolbar that has an image that appears to be a ghost (disabled copy) of the first button's icon. The toolbar behaves normally, otherwise. All my attempts to remove or account for the button have failed. The attached image shows the program behavior at the top, the toolbar editor in the middle and the properties for the "next" icon at the bottom.

    The development environment is Visual C++ 2017 (15.9.21). The program was originally developed under VS 6.0 and spent many years in VS 2005. However, the problem does not relate to the VS 2017 upgrade. That was accomplished two years ago.

    Note that I don't have much experience with direct editing in the *.rc file, but I'm willing to have a go at that with proper guidance.

    Thanks for any insight and/or assistance.

    FF
    Attached Images Attached Images  

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,598

    Re: Unwanted Toolbar Button

    Quote Originally Posted by FerroFun View Post
    This one's driving me nuts.

    I now have an unwanted, disabled button on my program's toolbar that has an image that appears to be a ghost (disabled copy) of the first button's icon. The toolbar behaves normally, otherwise. All my attempts to remove or account for the button have failed. The attached image shows the program behavior at the top, the toolbar editor in the middle and the properties for the "next" icon at the bottom.

    The development environment is Visual C++ 2017 (15.9.21). The program was originally developed under VS 6.0 and spent many years in VS 2005. However, the problem does not relate to the VS 2017 upgrade. That was accomplished two years ago.

    Note that I don't have much experience with direct editing in the *.rc file, but I'm willing to have a go at that with proper guidance.

    Thanks for any insight and/or assistance.

    FF
    It's probably in your MainFrm.cpp code. Look for an array called nButtons, and a call to m_wndToolBar.SetButtons(). If you don't see anything there, look for anything in MainFrm.cpp that has to to with initializing the toolbar.

  3. #3
    Join Date
    Feb 2008
    Posts
    26

    Re: Unwanted Toolbar Button

    Thanks for the suggestions. I am actually using a third-party library - Rogue Wave Stingray - to handle my windows. I pass a 0 count into the toolbar loading function. The library assigns the number of buttons - 17 - apparently when the toolbar is loaded. This is the correct number for the intended display if separators are included in the count. The actual display shows an additional separator and an additional button.

    I will continue to tilt at this starting next Monday. For now it's time for a holiday weekend.

    Thanks again.

    FF

  4. #4
    Join Date
    Feb 2008
    Posts
    26

    Re: Unwanted Toolbar Button

    This has gotten even stranger to me. The Toolbar Editor and *.rc files seem to have no effect whatsoever on the toolbar.

    I added a resource ID to the "next" button and did a quick icon. I added the resource to one of the program menus and added handlers. The second attached image ("Unwanted Toolbar Button 2") shows that the resource appears correctly in the menu when the resource is both enabled and disabled. The menu entry also properly calls the handler. However, the image shows that the toolbar remains unchanged.

    In the third attached image I show that the toolbar design differs completely from the program behavior. I have moved the new resource to fourth from the left. I did this by directly editing the *.rc file as shown. The *.rc changes appear in the Toolbar Editor, but not in the executing toolbar. Furthermore, the separators are misplaced in the executing toolbar and, apparently have been for some time.

    Even if there is some sort of bug in the Toolbar Editor, it seems to me that direct editing in the *.rc file should compile and display any changes.

    Thanks for any suggestions.

    FF
    Attached Images Attached Images   

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,598

    Re: Unwanted Toolbar Button

    As I said earlier, the problem isn't likely in the resource file, it's where the toolbar is getting created. If you're using MFC, lookin in Mainfrm.cpp. If you're not, look into whatever framework is actually creating the toolbar.

  6. #6
    Join Date
    Feb 2008
    Posts
    26

    Re: Unwanted Toolbar Button

    Yes, this is an MFC project.

    Your are most-likely correct. I will return my attention to code as soon as I clear a few other things out of the way.

    Thanks,

    FF

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,360

    Re: Unwanted Toolbar Button

    Does Rogue Wave Stingray handle the toolbar generation? If so, it might be good to post to their forum.

  8. #8
    Join Date
    Feb 2008
    Posts
    26

    Re: Unwanted Toolbar Button

    Thanks for the advise. I was going to do that next.

    FF

  9. #9
    Join Date
    Feb 2008
    Posts
    26

    Re: Unwanted Toolbar Button

    I seem to have corrected this problem locally by using the customize dialog to adjust the toolbar within the program. This is persistent. If the adjusted arrangement appears in the distributed program, the problem resolved, even if not programmatically.

    I am marking this as resolved

  10. #10
    Join Date
    Feb 2008
    Posts
    26

    Re: Unwanted Toolbar Button

    Uhm, how do I mark this as resolved?

  11. #11
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,797

    Re: Unwanted Toolbar Button

    In the toolbar above this thread press "button" Thread Tools and choose the context menu item Mark Thread Resolved
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)