Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TCloseDialogHandler


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Oct 3, 2016 11:53 PM Last Post By: Yves Depreitere
Yves Depreitere

Posts: 61
Registered: 5/20/02
TCloseDialogHandler  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 2, 2016 5:51 AM
The following code does work on Windows and Android, but fails to compile on OSX.
__fastcall TFrmMain::Do_Clear_Selected () is not accessible

It also does seem to compile on IOS, but can't run because of provisioning (see my other thread https://forums.embarcadero.com/thread.jspa?threadID=229768&tstart=0)

//---------------------------------------------------------------------------
void __fastcall TFrmMain::ActionManageClearSelectedExecute(TObject *Sender)
{
struct TCloseDialogHandler : public TCppInterfacedObject<TInputCloseDialogProc>
{
void __fastcall Invoke (const System::Uitypes::TModalResult AResult)
{
switch (AResult)
{
case mrYes : FrmMain->Do_Clear_Selected ();
break;
}
}
};

_di_TInputCloseDialogProc handler = new TCloseDialogHandler ();

String Message = "Clear all selections?";
TDialogServiceAsync::MessageDialog (Message, TMsgDlgType::mtInformation, TMsgDlgButtons() << TMsgDlgBtn::mbYes << TMsgDlgBtn::mbNo, TMsgDlgBtn::mbNo, 0, handler);
}
//---------------------------------------------------------------------------

How does one access the main from within the invoke function?

Greetings,
Yveske
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: TCloseDialogHandler  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 3, 2016 9:36 AM   in response to: Yves Depreitere in response to: Yves Depreitere
Yves wrote:

The following code does work on Windows and Android, but fails
to compile on OSX. __fastcall TFrmMain::Do_Clear_Selected ()
is not accessible

Since TCloseDialogHandler is not a member or a friend of the TFrmMain class,
it cannot access Do_Clear_Selected() directly unless Do_Clear_Selected()
is declared as public. Is it public? You did not show its declaration.

--
Remy Lebeau (TeamB)
Yves Depreitere

Posts: 61
Registered: 5/20/02
Re: TCloseDialogHandler  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 3, 2016 11:53 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thanks a million Remy!
Worked like a charm

Greetings,
Yveske

Remy Lebeau (TeamB) wrote:
Yves wrote:

The following code does work on Windows and Android, but fails
to compile on OSX. __fastcall TFrmMain::Do_Clear_Selected ()
is not accessible

Since TCloseDialogHandler is not a member or a friend of the TFrmMain class,
it cannot access Do_Clear_Selected() directly unless Do_Clear_Selected()
is declared as public. Is it public? You did not show its declaration.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02