0

I'm writing a FMX program in Delphi XE7 for Windows. I'm using TabControl. I need to show the message in active tab, when another tabitem is clicked.

Problem is that OnClick of TabItem, or OnChange of TabControl first displays a new tab and then shows me a message..and I need to get message before displaying a new tab

2 Answers 2

2

It's unclear how you display the message "in active tab" and why you want to show it in the tab you are just about to leave.

If you mean that you want to show a message using ShowMessage() before the tab change takes place you can do it in TTabItem OnMouseDown:

procedure TForm4.TabItem2MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Single);
begin
  ShowMessage('TabItem2MouseDown, Active tab: '+TabControl1.ActiveTab.Name);
end;

When TabItem1 is active and TabItem2 is clicked, the above code shows

TabItem2MouseDown, Active tab: TabItem1

and when you dismiss the message box the tab change takes place.

1
  • Thank you, i will try this. In different tabs i have infromation from different tables from database, so i need to show message dialog if some changes have been made, to confirm them defore leaving the tab :) Dec 24, 2014 at 13:25
0

I'm trying to use the accept solution above. Unfortunately, in Delphi Berlin FMX, by the time the MouseDown event occurs, the ActiveTab has already changed.

For anyone else looking for a solution, see Delphi can Fire monkey TTabControl replicate VCL TPageControl.OnChanging event as a possibility.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.