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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. combobox event in propertypage

combobox event in propertypage

Scheduled Pinned Locked Moved C / C++ / MFC
question
16 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.
  • S stevy82

    I've got a CFormView-derived class. It contains a CPropertySheet member, that is, it is not a CPropertySheet-derived class. On one page of the property sheet there is a combobox. So how can I treat a CBN_SELCHANGE event from that combobox within the View class? Pseudocode: public CMyView : CFormView {    CPropertySheet* m_sheet;    CPropertyPage* m_page; // this page contains a combobox } ...    m_sheet->AddPage(m_page); ... void CMyView::ComboBoxHandlerFcn {    DoSomething(); } stevy

    D Offline
    D Offline
    David Crow
    wrote on last edited by
    #2

    Normally the parent window of the control is notified.


    "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

    S 1 Reply Last reply
    0
    • D David Crow

      Normally the parent window of the control is notified.


      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

      S Offline
      S Offline
      stevy82
      wrote on last edited by
      #3

      Right, so I would have to handle the event in my CPropertySheet. Since I do not have a derived CPropertySheet class, I wish to handle it within the view class!

      D J 2 Replies Last reply
      0
      • S stevy82

        Right, so I would have to handle the event in my CPropertySheet. Since I do not have a derived CPropertySheet class, I wish to handle it within the view class!

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #4

        stevy82 wrote: Since I do not have a derived CPropertySheet class... Why not?


        "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

        S 1 Reply Last reply
        0
        • D David Crow

          stevy82 wrote: Since I do not have a derived CPropertySheet class... Why not?


          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

          S Offline
          S Offline
          stevy82
          wrote on last edited by
          #5

          Let's say, I have to do it so. You understand? ;-) Okay, now is there a possibility to handle it in the view or not?

          D 1 Reply Last reply
          0
          • S stevy82

            Right, so I would have to handle the event in my CPropertySheet. Since I do not have a derived CPropertySheet class, I wish to handle it within the view class!

            J Offline
            J Offline
            Jose Lamas Rios
            wrote on last edited by
            #6

            stevy82 wrote: Right, so I would have to handle the event in my CPropertySheet. Is the combo a child of the CPropertySheet or is in one of the property pages. If the latter, you can get the notification in your CPropertyPage derived class. -- jlr http://jlamas.blogspot.com/[^]

            S 1 Reply Last reply
            0
            • S stevy82

              Let's say, I have to do it so. You understand? ;-) Okay, now is there a possibility to handle it in the view or not?

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #7

              In the CBN_SELCHANGE notification handler, post a message to the view.


              "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

              S 1 Reply Last reply
              0
              • J Jose Lamas Rios

                stevy82 wrote: Right, so I would have to handle the event in my CPropertySheet. Is the combo a child of the CPropertySheet or is in one of the property pages. If the latter, you can get the notification in your CPropertyPage derived class. -- jlr http://jlamas.blogspot.com/[^]

                S Offline
                S Offline
                stevy82
                wrote on last edited by
                #8

                It is a child of a property page which is part of a property sheet. I do not have neither a derived sheet class nor a derived page class.

                J 1 Reply Last reply
                0
                • D David Crow

                  In the CBN_SELCHANGE notification handler, post a message to the view.


                  "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                  S Offline
                  S Offline
                  stevy82
                  wrote on last edited by
                  #9

                  How can I do that?

                  1 Reply Last reply
                  0
                  • S stevy82

                    It is a child of a property page which is part of a property sheet. I do not have neither a derived sheet class nor a derived page class.

                    J Offline
                    J Offline
                    Jose Lamas Rios
                    wrote on last edited by
                    #10

                    stevy82 wrote: It is a child of a property page which is part of a property sheet. I do not have neither a derived sheet class nor a derived page class. So, why don't you start writing a class derived from CPropertyPage? -- jlr http://jlamas.blogspot.com/[^]

                    S 1 Reply Last reply
                    0
                    • J Jose Lamas Rios

                      stevy82 wrote: It is a child of a property page which is part of a property sheet. I do not have neither a derived sheet class nor a derived page class. So, why don't you start writing a class derived from CPropertyPage? -- jlr http://jlamas.blogspot.com/[^]

                      S Offline
                      S Offline
                      stevy82
                      wrote on last edited by
                      #11

                      Because I was given the system in the way I mentioned and it is a demand not to create derived classes like that. Ain't it possible to handle the event within the View?

                      J 1 Reply Last reply
                      0
                      • S stevy82

                        Because I was given the system in the way I mentioned and it is a demand not to create derived classes like that. Ain't it possible to handle the event within the View?

                        J Offline
                        J Offline
                        Jose Lamas Rios
                        wrote on last edited by
                        #12

                        stevy82 wrote: Because I was given the system in the way I mentioned and it is a demand not to create derived classes like that. I have to wonder why anyone would impose such a restriction... stevy82 wrote: Ain't it possible to handle the event within the View? It might be, but it depends on what other restrictions you might have. Are you allowed to modify source files? Is it ok to write new code or are you only allowed to re-arrange the existing lines? ;P -- jlr http://jlamas.blogspot.com/[^]

                        S 1 Reply Last reply
                        0
                        • J Jose Lamas Rios

                          stevy82 wrote: Because I was given the system in the way I mentioned and it is a demand not to create derived classes like that. I have to wonder why anyone would impose such a restriction... stevy82 wrote: Ain't it possible to handle the event within the View? It might be, but it depends on what other restrictions you might have. Are you allowed to modify source files? Is it ok to write new code or are you only allowed to re-arrange the existing lines? ;P -- jlr http://jlamas.blogspot.com/[^]

                          S Offline
                          S Offline
                          stevy82
                          wrote on last edited by
                          #13

                          Of course, I'm allowed to write code ;) Which other restrictions (in fact there are no other restrictions than avoiding to create such sub classes) does it depend on? I just wonder how to get the CBN_SELCHANGE message passed to the view.

                          J 1 Reply Last reply
                          0
                          • S stevy82

                            Of course, I'm allowed to write code ;) Which other restrictions (in fact there are no other restrictions than avoiding to create such sub classes) does it depend on? I just wonder how to get the CBN_SELCHANGE message passed to the view.

                            J Offline
                            J Offline
                            Jose Lamas Rios
                            wrote on last edited by
                            #14

                            stevy82 wrote: Of course, I'm allowed to write code Oh, good! That's an start :) stevy82 wrote: Which other restrictions (in fact there are no other restrictions than avoiding to create such sub classes) does it depend on? Who is imposing that restriction? A silly restriction, if you don't mind my sincerity. Is this a real world program, or is it some sort of test? What's the reason for not wanting to derive the CPropertyPage? Please explain that. stevy82 wrote: I just wonder how to get the CBN_SELCHANGE message passed to the view. The easiest and logical way to do it is to derive the page, receive the notification there and pass it to wherever you want or need. It can also be done in other not so direct ways. For example, you might subclass[^] a window, either the combobox itself or its parent page, but perhaps that's against the rules too? -- jlr http://jlamas.blogspot.com/[^]

                            S 1 Reply Last reply
                            0
                            • J Jose Lamas Rios

                              stevy82 wrote: Of course, I'm allowed to write code Oh, good! That's an start :) stevy82 wrote: Which other restrictions (in fact there are no other restrictions than avoiding to create such sub classes) does it depend on? Who is imposing that restriction? A silly restriction, if you don't mind my sincerity. Is this a real world program, or is it some sort of test? What's the reason for not wanting to derive the CPropertyPage? Please explain that. stevy82 wrote: I just wonder how to get the CBN_SELCHANGE message passed to the view. The easiest and logical way to do it is to derive the page, receive the notification there and pass it to wherever you want or need. It can also be done in other not so direct ways. For example, you might subclass[^] a window, either the combobox itself or its parent page, but perhaps that's against the rules too? -- jlr http://jlamas.blogspot.com/[^]

                              S Offline
                              S Offline
                              stevy82
                              wrote on last edited by
                              #15

                              Jose Lamas Rios wrote: A silly restriction, if you don't mind my sincerity. You are right. Jose Lamas Rios wrote: Is this a real world program It is. Subclassing the combobox? Oh no. Well, I see I won't get it done within the view. I think I should rather occupy with the silly restriction than trying to find a solution. :doh:

                              J 1 Reply Last reply
                              0
                              • S stevy82

                                Jose Lamas Rios wrote: A silly restriction, if you don't mind my sincerity. You are right. Jose Lamas Rios wrote: Is this a real world program It is. Subclassing the combobox? Oh no. Well, I see I won't get it done within the view. I think I should rather occupy with the silly restriction than trying to find a solution. :doh:

                                J Offline
                                J Offline
                                Jose Lamas Rios
                                wrote on last edited by
                                #16

                                stevy82 wrote: I think I should rather occupy with the silly restriction than trying to find a solution Sounds like a good plan to me :) -- jlr http://jlamas.blogspot.com/[^]

                                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