suggestion Root › Technical support › Troubleshooting This topic has 6 replies, 3 voices, and was last updated 5 years, 9 months ago by Stephane Senecal. Viewing 7 posts - 1 through 7 (of 7 total) Author Posts January 29, 2019 at 5:16 pm #38135 SpeedTIParticipant Is it possible to add the FromPage and ToPage parameters in the OnChanging event of the TsPageControl component? That would make it a lot easier in some situations. Thank you. Regards Valdir Sola January 30, 2019 at 6:17 am #58988 SupportKeymaster Hello Standard event can't be changed, but you can try the OnPageChanging event which exists already: Code: TacTabChangingEvent = procedure(Sender: TObject; NewPage: TsTabSheet; var AllowChange: Boolean) of object; January 30, 2019 at 12:48 pm #58998 SpeedTIParticipant 'Support' wrote: Hello Standard event can't be changed, but you can try the OnPageChanging event which exists already: Code: TacTabChangingEvent = procedure(Sender: TObject; NewPage: TsTabSheet; var AllowChange: Boolean) of object; Thank you. It helps but not much. Is it possible to create an event that contains these parameters? Regards Valdir Sola February 1, 2019 at 5:56 am #59010 SupportKeymaster 'vsola' wrote: Thank you. It helps but not much. Is it possible to create an event that contains these parameters? Why not? FromPage is sPageControl1.ActivePage; ToPage is NewPage parameter in this event. February 1, 2019 at 1:52 pm #59017 Stephane SenecalParticipant The way I do it, is to get the coordinates of the cursor from the message by calling GetMessagePos() and get the tab under those coordinates. Note that GetMessagePos() return the cursor position relative to the display, not the PageControl. Code: procedure TForm1.sPageControl1Changing(Sender: TObject; var AllowChange: Boolean); var iCoord:Cardinal; pt:TPoint; iFromTab:Integer; iToTab:Integer; begin iCoord := GetMessagePos(); pt := sPageControl1.ScreenToClient( Point( LoWord( iCoord ), HiWord( iCoord ) ) ); iToTab := sPageControl1.GetTabUnderMouse( pt ); iFromTab := sPageControl1.ActivePageIndex; end; Stephane Senecal CIS Group Delphi programmer since 2001 February 5, 2019 at 8:15 am #59026 SupportKeymaster Stephane, the OnPageChanging event exists in the TsPageControl with the “NewPage” parameter, there is no needs to search a tab under mouse. February 5, 2019 at 1:21 pm #59033 Stephane SenecalParticipant Oh, I didn't know that. Interesting. Thanks Stephane Senecal CIS Group Delphi programmer since 2001 Author Posts Viewing 7 posts - 1 through 7 (of 7 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In Root › Technical support › Troubleshooting