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. Managed C++/CLI
  4. WinForms: How to override this method?

WinForms: How to override this method?

Scheduled Pinned Locked Moved Managed C++/CLI
csharpwinformshelptutorialquestion
3 Posts 2 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.
  • L Offline
    L Offline
    Libor Tinka
    wrote on last edited by
    #1

    I'm trying to make simple class derived from ComboBox that processes some command keys. Here is the code: #pragma once using namespace System; using namespace System::Windows::Forms; namespace ProjectX { public ref class EnterComboBox : public ComboBox { public: EnterComboBox(void) { } protected: virtual void ComboBox::ProcessCmdKey(Message^% msg, Keys^ k) override { MessageBox::Show("cmdkey"); ComboBox::ProcessCmdKey(&msg, k); } }; } The compiler outputs error C3254: 'ProjectX::EnterComboBox' : class contains explicit override 'ProcessCmdKey' but does not derive from an interface that contains the function declaration I'm confused. There is no such interface. I've searched whole e-books, forums for the code sample (and more common overrides, like OnPaint, OnResize etc.) and there is no answer how the hell override some method from the Control's base class :mad:

    G 1 Reply Last reply
    0
    • L Libor Tinka

      I'm trying to make simple class derived from ComboBox that processes some command keys. Here is the code: #pragma once using namespace System; using namespace System::Windows::Forms; namespace ProjectX { public ref class EnterComboBox : public ComboBox { public: EnterComboBox(void) { } protected: virtual void ComboBox::ProcessCmdKey(Message^% msg, Keys^ k) override { MessageBox::Show("cmdkey"); ComboBox::ProcessCmdKey(&msg, k); } }; } The compiler outputs error C3254: 'ProjectX::EnterComboBox' : class contains explicit override 'ProcessCmdKey' but does not derive from an interface that contains the function declaration I'm confused. There is no such interface. I've searched whole e-books, forums for the code sample (and more common overrides, like OnPaint, OnResize etc.) and there is no answer how the hell override some method from the Control's base class :mad:

      G Offline
      G Offline
      George L Jackson
      wrote on last edited by
      #2

      You have a mismatch, and it should be: virtual bool ProcessCmdKey( Message% msg, Keys keyData ) override

      "We make a living by what we get, we make a life by what we give." --Winston Churchill

      L 1 Reply Last reply
      0
      • G George L Jackson

        You have a mismatch, and it should be: virtual bool ProcessCmdKey( Message% msg, Keys keyData ) override

        "We make a living by what we get, we make a life by what we give." --Winston Churchill

        L Offline
        L Offline
        Libor Tinka
        wrote on last edited by
        #3

        Now it works, thanks. But another few hours have been spoiled on this either.

        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