Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Permanent popup menu (aka list control) c++, MFC

Permanent popup menu (aka list control) c++, MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpvisual-studiotutorialquestion
13 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arthur89kim
    wrote on last edited by
    #1

    I'm using Microsoft Visual Studio 2005 and I'm new to MFC application. :-O The task I'm given is to create a popup menu (CMenu::CreatePopupMenu) somehow looks like a list control. This occurs to do some limitation of a list control. Is there a way to do it without using WM_DRAWITEM and WM_MEASUREITEM? Or does anyone knows how to attach a popup menu onto a picture control (CStatic)? or ShowWindow to show the popup menu permanently? Either way is fine with me. Will be waiting for reply~ TQ!!! ;)

    Sincerely, arthur89kim

    L S 2 Replies Last reply
    0
    • A arthur89kim

      I'm using Microsoft Visual Studio 2005 and I'm new to MFC application. :-O The task I'm given is to create a popup menu (CMenu::CreatePopupMenu) somehow looks like a list control. This occurs to do some limitation of a list control. Is there a way to do it without using WM_DRAWITEM and WM_MEASUREITEM? Or does anyone knows how to attach a popup menu onto a picture control (CStatic)? or ShowWindow to show the popup menu permanently? Either way is fine with me. Will be waiting for reply~ TQ!!! ;)

      Sincerely, arthur89kim

      S Offline
      S Offline
      Sauro Viti
      wrote on last edited by
      #2

      Can you explain a bit more what you need? What I understood is that you want to use a popup menu instead than a list control because you want something like a list control with reduced functionalities and custom behaviours; isn't it? Can't you write a class that inherit from CListCtrl and modifies the standard behaviours?

      A 1 Reply Last reply
      0
      • A arthur89kim

        I'm using Microsoft Visual Studio 2005 and I'm new to MFC application. :-O The task I'm given is to create a popup menu (CMenu::CreatePopupMenu) somehow looks like a list control. This occurs to do some limitation of a list control. Is there a way to do it without using WM_DRAWITEM and WM_MEASUREITEM? Or does anyone knows how to attach a popup menu onto a picture control (CStatic)? or ShowWindow to show the popup menu permanently? Either way is fine with me. Will be waiting for reply~ TQ!!! ;)

        Sincerely, arthur89kim

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        I'm not sure that I fully understand your question, but a popup menu is, by its nature, a transient item. It pops up, the user makes a selection, it disappears. If you want some sort of permanent list on display I think you may need to use a different control. Perhaps you could give some more detail on the problem you are trying to solve.

        It's time for a new signature.

        A 1 Reply Last reply
        0
        • S Sauro Viti

          Can you explain a bit more what you need? What I understood is that you want to use a popup menu instead than a list control because you want something like a list control with reduced functionalities and custom behaviours; isn't it? Can't you write a class that inherit from CListCtrl and modifies the standard behaviours?

          A Offline
          A Offline
          arthur89kim
          wrote on last edited by
          #4

          Yes. Just like what u mentioned. What I need to do is to create a popup menu literally looks like list control. The reason why I do so is because I found out that the list control icon attribute as following... m_list.SetExtendedStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT); ...where when I click on one of the item, I manage to select the whole row but not able to highlight the icon itself. If u have notice, when you put in the above code, there will be an empty white space reserved for the icon to be loaded. My original task is to eliminate that white space (in other words is to make it transparent). For example, I'm trying to make the list control to be exactly same as the right click button in Adobe PDF reader where i can select whole row with icon (transparent background) and a tick (check mark). By the way, the icons I obtained is from EnumWindowProc where I get from Window Application (same as ALT + TAB button)

          Sincerely, arthur89kim

          S 1 Reply Last reply
          0
          • L Lost User

            I'm not sure that I fully understand your question, but a popup menu is, by its nature, a transient item. It pops up, the user makes a selection, it disappears. If you want some sort of permanent list on display I think you may need to use a different control. Perhaps you could give some more detail on the problem you are trying to solve.

            It's time for a new signature.

            A Offline
            A Offline
            arthur89kim
            wrote on last edited by
            #5

            What I need to do is to create a popup menu literally looks like list control. The reason why I do so is because I found out that the list control icon attribute as following... m_list.SetExtendedStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT); ...where when I click on one of the item, I manage to select the whole row but not able to highlight the icon itself. If u have notice, when you put in the above code, there will be an empty white space reserved for the icon to be loaded. My original task is to eliminate that white space (in other words is to make it transparent). For example, I'm trying to make the list control to be exactly same as the right click button in Adobe PDF reader where i can select whole row with icon (transparent background) and a tick (check mark). By the way, the icons I obtained is from EnumWindowProc where I get from Window Application (same as ALT + TAB button).

            Sincerely, arthur89kim

            L 1 Reply Last reply
            0
            • A arthur89kim

              Yes. Just like what u mentioned. What I need to do is to create a popup menu literally looks like list control. The reason why I do so is because I found out that the list control icon attribute as following... m_list.SetExtendedStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT); ...where when I click on one of the item, I manage to select the whole row but not able to highlight the icon itself. If u have notice, when you put in the above code, there will be an empty white space reserved for the icon to be loaded. My original task is to eliminate that white space (in other words is to make it transparent). For example, I'm trying to make the list control to be exactly same as the right click button in Adobe PDF reader where i can select whole row with icon (transparent background) and a tick (check mark). By the way, the icons I obtained is from EnumWindowProc where I get from Window Application (same as ALT + TAB button)

              Sincerely, arthur89kim

              S Offline
              S Offline
              Sauro Viti
              wrote on last edited by
              #6

              Then what you want is a list control with a customized appearance. For this, the best is to use a owner-draw list control with the owner-draw property set (i.e. created using the LVS_OWNERDRAWFIXED style); then process the WM_DRAWITEM to give your control the apeearance you want. Look at these links for some samples:

              • http://www.codeproject.com/info/search.aspx?artkw=++listcontrol+%2b+c%2b%2b&sbo=kw[^]
              • XListCtrl - A custom-draw list control with subitem formatting[^]
              • Neat Stuff to Do in List Controls Using Custom Draw[^]
              • How to skin CListCtrl including scrollbars and column headers[^]
              A 1 Reply Last reply
              0
              • S Sauro Viti

                Then what you want is a list control with a customized appearance. For this, the best is to use a owner-draw list control with the owner-draw property set (i.e. created using the LVS_OWNERDRAWFIXED style); then process the WM_DRAWITEM to give your control the apeearance you want. Look at these links for some samples:

                • http://www.codeproject.com/info/search.aspx?artkw=++listcontrol+%2b+c%2b%2b&sbo=kw[^]
                • XListCtrl - A custom-draw list control with subitem formatting[^]
                • Neat Stuff to Do in List Controls Using Custom Draw[^]
                • How to skin CListCtrl including scrollbars and column headers[^]
                A Offline
                A Offline
                arthur89kim
                wrote on last edited by
                #7

                Thanks for the reply. I'll look into it. I was hoping to find alternative way to solve it without using owner-draw or other drawing method. :-O If that's the case, I shall study on it. Thanks again.

                Sincerely, arthur89kim

                1 Reply Last reply
                0
                • A arthur89kim

                  What I need to do is to create a popup menu literally looks like list control. The reason why I do so is because I found out that the list control icon attribute as following... m_list.SetExtendedStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT); ...where when I click on one of the item, I manage to select the whole row but not able to highlight the icon itself. If u have notice, when you put in the above code, there will be an empty white space reserved for the icon to be loaded. My original task is to eliminate that white space (in other words is to make it transparent). For example, I'm trying to make the list control to be exactly same as the right click button in Adobe PDF reader where i can select whole row with icon (transparent background) and a tick (check mark). By the way, the icons I obtained is from EnumWindowProc where I get from Window Application (same as ALT + TAB button).

                  Sincerely, arthur89kim

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  I am still very confused about your requirements. If you have a popup menu then the selection rectangle will cover the entire width of the item you select; just right click on this page and move your mouse up and down the list.

                  It's time for a new signature.

                  A 1 Reply Last reply
                  0
                  • L Lost User

                    I am still very confused about your requirements. If you have a popup menu then the selection rectangle will cover the entire width of the item you select; just right click on this page and move your mouse up and down the list.

                    It's time for a new signature.

                    A Offline
                    A Offline
                    arthur89kim
                    wrote on last edited by
                    #9

                    Sorry for the confusion, I was given task to make a list control with icons (EnumWindowProc from windows' applications) and a tick (check mark) to indicate my item is selected when I double click on it. However, the drawback of using list control occurs when I highlight the item before double clicking it. This is where my task given, I am suppose to make a full row highlight without white space (especially when there is an icon in the list). The white space is reserved for the icons inserted into it. Hence, I was trying to use CMenu to obtain desirable results (exp: right click on PDF file to see the popup menu). ;P Nevertheless, by using popup menu, I am not able to show the popup menu permanently as we can do with list control. I hope my statements do clear up the confusion made. Thanks for your patient to help me out. :-O

                    Sincerely, arthur89kim

                    L 1 Reply Last reply
                    0
                    • A arthur89kim

                      Sorry for the confusion, I was given task to make a list control with icons (EnumWindowProc from windows' applications) and a tick (check mark) to indicate my item is selected when I double click on it. However, the drawback of using list control occurs when I highlight the item before double clicking it. This is where my task given, I am suppose to make a full row highlight without white space (especially when there is an icon in the list). The white space is reserved for the icons inserted into it. Hence, I was trying to use CMenu to obtain desirable results (exp: right click on PDF file to see the popup menu). ;P Nevertheless, by using popup menu, I am not able to show the popup menu permanently as we can do with list control. I hope my statements do clear up the confusion made. Thanks for your patient to help me out. :-O

                      Sincerely, arthur89kim

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      If you use a normal list control with the LVS_EX_FULLROWSELECT style then you will get the result you are asking for. Take a look at any Windows program (Windows Explorer for example) that has a list view and you will see what I mean.

                      It's time for a new signature.

                      A 1 Reply Last reply
                      0
                      • L Lost User

                        If you use a normal list control with the LVS_EX_FULLROWSELECT style then you will get the result you are asking for. Take a look at any Windows program (Windows Explorer for example) that has a list view and you will see what I mean.

                        It's time for a new signature.

                        A Offline
                        A Offline
                        arthur89kim
                        wrote on last edited by
                        #11

                        Thanks for your reply. I have try it out but no different. There is still white space withing that icon area.

                        Sincerely, arthur89kim

                        L 1 Reply Last reply
                        0
                        • A arthur89kim

                          Thanks for your reply. I have try it out but no different. There is still white space withing that icon area.

                          Sincerely, arthur89kim

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #12

                          arthur89kim wrote:

                          I have try it out but no different. There is still white space withing that icon area.

                          I am still not sure what it is you are trying to achieve and why white space is so important.

                          It's time for a new signature.

                          A 1 Reply Last reply
                          0
                          • L Lost User

                            arthur89kim wrote:

                            I have try it out but no different. There is still white space withing that icon area.

                            I am still not sure what it is you are trying to achieve and why white space is so important.

                            It's time for a new signature.

                            A Offline
                            A Offline
                            arthur89kim
                            wrote on last edited by
                            #13

                            That is the task I'm given. To eliminate the white space in order to make it a full row highlight without white space. It would seems more professional that way. By the way, thanks for your reply. I will try out the WM_DRAWITEM as mentioned by Sauro Viti.

                            Sincerely, arthur89kim

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups