0
私はWxDevフレームを使ってプログラムのGUIを開発しています。 "Upload"と "Analyze"の2つのボタンがあります。ボタン機能を無効にする(Wxウィジェット)
シーケンスは、ユーザーが画像をアップロードする必要があります。アップロードされると、彼は「分析」ボタンをクリックすることができます。さて、彼が分析をクリックすると、私はそれを無効にしたいと思うでしょう。分析する新しい画像があれば、ボタンは有効になります。
ここには、私が持っているボタンのコードはありませんが、無関係かもしれません。
UPLOAD:
void NBA_Jersey_RecognitionFrm::WxButton1Click(wxCommandEvent& event)
{
openIMGFileDialog->ShowModal();
if (openIMGFileDialog->GetPath().IsEmpty())
{
return;
}
imageopen = imgFile.LoadFile(openIMGFileDialog->GetPath(), wxBITMAP_TYPE_ANY);
int h = imgFile.GetHeight();
int w = imgFile.GetWidth();
pic.Create(w,h);
for (int x = 0; x < w; x++)
{
for (int y = 0; y < h; y++)
{
pic.SetRGB(x, y, 240, 240, 240);
}
}
if (300 >= (h*300/w))
{
displayIMG->SetBitmap(pic.Scale(300,h*300/w));
displayIMG->SetBitmap(imgFile.Scale(300,h*300/w));
}
else
{
displayIMG->SetBitmap(pic.Scale(w*300/h,300));
displayIMG->SetBitmap(imgFile.Scale(w*300/h,300));
}
}
は、ここに私のANALYZEボタンの抜粋です:
void NBA_Jersey_RecognitionFrm::WxButton1Click0(wxCommandEvent& 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<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 << "x,y,Red,Green,Blue \n";
for(int h=0; h<height; h++) {
for(int w=0; w<width; w++) {
RedVal[w][h]=imgFile.GetRed(w,h);
GreenVal[w][h]=imgFile.GetGreen(w,h);
BlueVal[w][h]=imgFile.GetBlue(w,h);
//ss << h << "," << w << "," << RedVal[0][h] << "," << GreenVal[0][h] << "," << BlueVal[0][h] <<"\n";
//resultsFile << ss.str();
//resultsFile << h << "," << w << "," << RedVal[w][h] << "," << GreenVal[w][h] << "," << BlueVal[w][h] <<"\n";
}
}
はボタンを無効化についてWxDev C++での組み込み関数はありますか?または、私が持っているコードに何を追加すればよいですか?ありがとうございました。
私は上記の方法を示したと思います。 "m_analyzeButton-> Enable(true);"を呼び出す必要があります。 (m_analyzeButtonをボタンの名前に置き換えて)UploadボタンのイベントハンドラのどこかでAnalyzeボタンを再度有効にします。 –
ありがとうございます。それは今働く。 – AndyMarty