title: Disable Button Functionality (Wx Widgets)
body: <p>So I'm using the WxDev frame to develop the GUI of our program.
  So it has two buttons, "Upload" and "Analyze".</p>
  
  <p>The sequence should be a user uploads an image. Once it's uploaded, he has the capability of clicking the "Analyze" button. Now, once he clicks the analyze, I would want to disable it. The button will only be then enabled once there is a new image to analyze.</p>
  
  <p>Here's the code for the buttons I have although it might be irrelevant.</p>
  
  <p>UPLOAD:</p>
  
  <pre><code>void NBA_Jersey_RecognitionFrm::WxButton1Click(wxCommandEvent&amp; event)
  {
   openIMGFileDialog-&gt;ShowModal();
      if (openIMGFileDialog-&gt;GetPath().IsEmpty())
      {
          return;
      }
  
      imageopen = imgFile.LoadFile(openIMGFileDialog-&gt;GetPath(), wxBITMAP_TYPE_ANY);
  
      int h = imgFile.GetHeight();
      int w = imgFile.GetWidth();
  
      pic.Create(w,h);
  
          for (int x = 0; x &lt; w; x++)
          {
               for (int y = 0; y &lt; h; y++)
              {
                  pic.SetRGB(x, y, 240, 240, 240);
              }
          }
  
      if (300 &gt;= (h*300/w))
      {       
          displayIMG-&gt;SetBitmap(pic.Scale(300,h*300/w));
          displayIMG-&gt;SetBitmap(imgFile.Scale(300,h*300/w));
      } 
      else
      {
          displayIMG-&gt;SetBitmap(pic.Scale(w*300/h,300));
          displayIMG-&gt;SetBitmap(imgFile.Scale(w*300/h,300));
      }
  
  }
  </code></pre>
  
  <p>Here's an excerpt of my ANALYZE button:</p>
  
  <pre><code>void NBA_Jersey_RecognitionFrm::WxButton1Click0(wxCommandEvent&amp; event)
  {
      ofstream resultsFile;
  
      stringstream ss;
      string s;
  
      int height = imgFile.GetHeight();
      int width = imgFile.GetWidth();
  
      RedVal = new int* [width];
      GreenVal = new int* [width];
      BlueVal= new int* [width];
  
      for(int i=0; i&lt;width; i++) {
          RedVal[i] = new int[height];
          GreenVal[i] = new int[height];
          BlueVal[i] = new int[height];
      }
  
  
      //int RedVal[width][height];
      //int GreenVal[width][height];
      //int BlueVal[width][height];
  
      resultsFile.open("results.txt");
      //resultsFile &lt;&lt; "x,y,Red,Green,Blue \n";
  
  
      for(int h=0; h&lt;height; h++) {
          for(int w=0; w&lt;width; w++) {
  
              RedVal[w][h]=imgFile.GetRed(w,h);
              GreenVal[w][h]=imgFile.GetGreen(w,h);
              BlueVal[w][h]=imgFile.GetBlue(w,h);
  
              //ss &lt;&lt; h &lt;&lt; "," &lt;&lt; w &lt;&lt; "," &lt;&lt; RedVal[0][h] &lt;&lt; "," &lt;&lt; GreenVal[0][h] &lt;&lt; "," &lt;&lt; BlueVal[0][h] &lt;&lt;"\n";
              //resultsFile &lt;&lt; ss.str();
              //resultsFile &lt;&lt; h &lt;&lt; "," &lt;&lt; w &lt;&lt; "," &lt;&lt; RedVal[w][h] &lt;&lt; "," &lt;&lt; GreenVal[w][h] &lt;&lt; "," &lt;&lt; BlueVal[w][h] &lt;&lt;"\n";
          }
  
      }
  </code></pre>
  
  <p>Is there a built-in function in WxDev C++ about disabling a button? Or what should I add to the code I have? Thank you.</p>