Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing A Parameter to A DialogBox 1

Status
Not open for further replies.

MrProgrammer

Programmer
Feb 1, 2002
41
0
0
TR
Hello again,

I created a dialog box named TOKRightDlg. I want to pass a parameter to this dialog box when I call it. Is it possible??
 
First I tried to use the classical expression "OKRightDlg->Show();". But this is not what want to. For example, is there something like "OKRightDlg->Execute(SomeParameter);" ?
 
Perhaps you could create a public function with the paramaters you want, then call Show() from within that function, for example:

Code:
// TOKRightDlg's .h file
class TOKRightDlg : public TForm
{
__published:
  // stuff
private:
  // stuff
public:
  bool Execute(AnsiString ExampleParamater);
  // stuff
}

// TOKRightDlg's .cpp file
bool TOKRightDlg::Execute(AnsiString ExampleParamater)
{
// do some stuff with the paramater
if (OKRightDlg->ShowModal() == mrOk)
  return true;
else
  return false;
}

Then, when you want to call the dialog box, use
Code:
if (OKRightDlg->Execute("Something"))
  // do something
 
OKRightDlg->Tag = test;
OKRightDlg->Show;

OKRightDlg->onshow test for tag = what;

"test" is previously defined.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top