Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-09

Help translating C++ to Object Pascal

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

In a C++ method as shown below, does the '... return True;' immediately exit the HandleClientMessage method, or will it still continue processing the remainder of the method (just exiting the current code block)?

--------------------------------
int OXMainFrame::HandleClientMessage(XClientMessageEvent *event) {

  if (_dndManager) {
    if (_dndManager->HandleClientMessage(event)) return True;
  }
  if ((event->format == 32) && (event->data.l[0] == WM_DELETE_WINDOW)) {
    CloseWindow();
    return True;
  }
  return OXCompositeFrame::HandleClientMessage(event);
}

--------------------------------

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Reimar Grabowski
to Graeme Geldenhuys
Hi, In a C++ method as shown below, does the '... return True;' immediately exit the HandleClientMessage method

Yes.

R.

A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?

Reply by email

David W Noon
to Graeme Geldenhuys: In a C++ method as shown below, does the '... return True;' immediately exit the…

On Tue, 14 Sep 2010 11:50:31 +0200, Graeme Geldenhuys wrote about [fpc-pascal] Help translating C++ to Object Pascal:

In a C++ method as shown below, does the '... return True;' immediately exit the HandleClientMessage method, or will it still continue processing the remainder of the method (just exiting the current code block)?

It will return directly to the calling routine. The following statement:

return OXCompositeFrame::HandleClientMessage(event);

will be ignored.

Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Reply by email

Sven Barth
to Graeme Geldenhuys: In a C++ method as shown below, does the '... return True;' immediately exit the…
Graeme Geldenhuys wrote 21 lines
Hi, In a C++ method as shown below, does the '... return True;' immediately exit the HandleClientMessage method, or will it still continue processing the remainder of the method (just exiting the current code block)? -------------------------------- int OXMainFrame::HandleClientMessage(XClientMessageEvent *event) { if (_dndManager) { if (_dndManager->HandleClientMessage(event)) return True; } if ((event->format == 32)&& (event->data.l[0] == WM_DELETE_WINDOW)) { CloseWindow(); return True; } return OXCompositeFrame::HandleClientMessage(event); }

"return Something;" in C/C++ is equivalent to "Exit(Something);" in FPC's Pascal.

Regards,
Sven

Reply by email