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. Copying control events

Copying control events

Scheduled Pinned Locked Moved Managed C++/CLI
helpquestion
2 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.
  • E Offline
    E Offline
    earlgraham
    wrote on last edited by
    #1

    Is there a way to copy the events associated with a control to another control? Like this ( will give a compiler error )

    this->button->click = this->otherbutton->click;

    Thanks PS this relates to my earlier post

    Programmer Glenn Earl Graham Austin, TX

    G 1 Reply Last reply
    0
    • E earlgraham

      Is there a way to copy the events associated with a control to another control? Like this ( will give a compiler error )

      this->button->click = this->otherbutton->click;

      Thanks PS this relates to my earlier post

      Programmer Glenn Earl Graham Austin, TX

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

      If button and otherbutton is set up this way:

      this->button->Click += gcnew System::EventHandler(this, &Form1::button_Click);
      this->otherbutton->Click += gcnew System::EventHandler(this, &Form1::otherbutton_Click);

      then you can add "otherbutton" to also handle button's event thus:

      this->button->Click += gcnew System::EventHandler(this, &Form1::otherbutton_Click);

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

      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