Click here to Skip to main content
15,917,329 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to log text from a edit box into file? Pin
CPallini11-Nov-08 1:41
mveCPallini11-Nov-08 1:41 
QuestionHow to connect remote system in internet Pin
Kiran Pinjala11-Nov-08 1:01
Kiran Pinjala11-Nov-08 1:01 
AnswerRe: How to connect remote system in internet Pin
Mark Salsbery11-Nov-08 6:08
Mark Salsbery11-Nov-08 6:08 
QuestionRe: How to connect remote system in internet Pin
Kiran Pinjala11-Nov-08 22:28
Kiran Pinjala11-Nov-08 22:28 
AnswerRe: How to connect remote system in internet Pin
Mark Salsbery12-Nov-08 6:30
Mark Salsbery12-Nov-08 6:30 
GeneralRe: How to connect remote system in internet Pin
Kiran Pinjala12-Nov-08 18:22
Kiran Pinjala12-Nov-08 18:22 
GeneralRe: How to connect remote system in internet Pin
Mark Salsbery12-Nov-08 20:28
Mark Salsbery12-Nov-08 20:28 
QuestionCreating new buttons (and let them do something) Pin
wielklem11-Nov-08 0:58
wielklem11-Nov-08 0:58 
hello,

it's kind of a newbie question, but i couldn't find it anyware so;

from an edit box i create a number if buttons, by pushing the "create" button.
that works without a problem.
now i want the button i just created to change colour or disapear when i click on it.
or i want an other button to disapear (ia with a textbox to filin witch one to disapear)
and that part just won work.
the number of buttons i want to create is unlimmited (1000 in this code).
what can i do?

#include <vcl.h>
#pragma hdrstop
using namespace std;
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
  TButton   *Button[1000];
  int count;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{          // this is the create button
          Button[count] = new TButton(this);
          Button[count]->Parent=Form1;
          Button[count]->Visible=true;
          Button[count]->Top=(count*20)+10;
          Button[count]->Left=10;
          Button[count]->Caption= "Button "+IntToStr(count);
}

void __fastcall TForm1::Edit1Change(TObject *Sender)
{
count = StrToInt(Edit1->Text);    // this is the editbox
}


by the way, i'm using borland c++builder

wkr,
Willem

the final code wil be somthing like this:

// reading source file
// the int NumberOfSource is allready read by an other file reader


        ifstream SOSfile("config\\sos.cfg"); // opening file

  int ButtonCounter = 1 ;
while(NumberOfSource !=0)
{
        getline(SOSfile,input);
        SOButtonID = input.c_str(); //  Button ID
        getline(SOSfile,input);
        SOLEFT = StrToInt(input.c_str()); //  button left space
        getline(SOSfile,input);
        SOTOP = StrToInt(input.c_str()); //  Button TOP
        getline(SOSfile,input);
        SOImage = input.c_str(); // image for button
        getline(SOSfile,input);
        SOPAGE = StrToInt(input.c_str()); //  pagina voor de button
        getline(SOSfile,input);
        SOCaption = input.c_str(); //  Caption in button
        getline(SOSfile,input);
        SOSource = input.c_str(); //   source to switch
        getline(SOSfile,input);
        SOSpare = input.c_str(); //  spare
        getline(SOSfile,input);
        SOSpare = input.c_str(); //  spare
        getline(SOSfile,input);
        SOSpare = input.c_str(); //  spare

        // button properties begin:

          BitBtn[SOIDButton]=new TBitBtn(this);
          BitBtn[SOIDButton]->Name= SOButtonID.c_str();
          BitBtn[SOIDButton]->Visible=true;
          BitBtn[SOIDButton]->Height = 57;
          BitBtn[SOIDButton]->Width = 57;
          BitBtn[SOIDButton]->Top=SOTOP;
          BitBtn[SOIDButton]->Left= SOLEFT;
          BitBtn[SOIDButton]->Bitmap->LoadFromFile(SOImage.c_str());
          BitBtn[SOIDButton]->Caption = BitBtn[SOIDButton]->Name;  //SOCaption.c_str();
          if(ButtonCounter <= 18){BitBtn[SOIDButton]->Parent = PanelSO1;}
          if(ButtonCounter > 18 && ButtonCounter <= 36){BitBtn[SOIDButton]->Parent = PanelSO2;}
          if(ButtonCounter > 36 && ButtonCounter <= 54){BitBtn[SOIDButton]->Parent = PanelSO3;}
          if(ButtonCounter > 54 && ButtonCounter <= 64){BitBtn[SOIDButton]->Parent = PanelSO2;}


          // end button properties

         ButtonCounter = ButtonCounter + 1;
        NumberOfSource = NumberOfSource - 1;

}

// end reading source file


i just want these new created buttons to do something unique (read from the file)
QuestionRe: Creating new buttons (and let them do something) Pin
David Crow11-Nov-08 3:11
David Crow11-Nov-08 3:11 
AnswerRe: Creating new buttons (and let them do something) Pin
wielklem11-Nov-08 3:31
wielklem11-Nov-08 3:31 
GeneralRe: Creating new buttons (and let them do something) Pin
David Crow11-Nov-08 4:34
David Crow11-Nov-08 4:34 
GeneralRe: Creating new buttons (and let them do something) Pin
wielklem11-Nov-08 23:46
wielklem11-Nov-08 23:46 
GeneralRe: Creating new buttons (and let them do something) Pin
David Crow12-Nov-08 2:47
David Crow12-Nov-08 2:47 
JokeRe: Creating new buttons (and let them do something) Pin
Mark Salsbery11-Nov-08 6:10
Mark Salsbery11-Nov-08 6:10 
GeneralRe: Creating new buttons (and let them do something) Pin
David Crow11-Nov-08 6:13
David Crow11-Nov-08 6:13 
GeneralRe: Creating new buttons (and let them do something) Pin
Mark Salsbery11-Nov-08 7:00
Mark Salsbery11-Nov-08 7:00 
QuestionCMenu Item Text Pin
h@$@n11-Nov-08 0:41
h@$@n11-Nov-08 0:41 
AnswerRe: CMenu Item Text Pin
CPallini11-Nov-08 0:58
mveCPallini11-Nov-08 0:58 
QuestionProblem with GetAdaptersAddresses in Windows Vista Pin
Hector_M11-Nov-08 0:29
Hector_M11-Nov-08 0:29 
AnswerRe: Problem with GetAdaptersAddresses in Windows Vista Pin
Hector_M11-Nov-08 2:37
Hector_M11-Nov-08 2:37 
GeneralRe: Problem with GetAdaptersAddresses in Windows Vista Pin
Mark Salsbery11-Nov-08 6:19
Mark Salsbery11-Nov-08 6:19 
GeneralRe: Problem with GetAdaptersAddresses in Windows Vista Pin
Hector_M11-Nov-08 22:00
Hector_M11-Nov-08 22:00 
GeneralRe: Problem with GetAdaptersAddresses in Windows Vista Pin
Mark Salsbery12-Nov-08 6:28
Mark Salsbery12-Nov-08 6:28 
GeneralRe: Problem with GetAdaptersAddresses in Windows Vista Pin
Hector_M12-Nov-08 21:31
Hector_M12-Nov-08 21:31 
GeneralRe: Problem with GetAdaptersAddresses in Windows Vista Pin
David Crow11-Nov-08 7:20
David Crow11-Nov-08 7:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.