artem_niko Posted November 12, 2022 Share Posted November 12, 2022 Good afternoon! Such a question: is it possible to make the UniTabSheet header as a button? So that clicking on the title triggers the same event as when clicking on a regular button. Or is it impossible to do it? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 12, 2022 Share Posted November 12, 2022 Hello, This post may help you: 1 Quote Link to comment Share on other sites More sharing options...
artem_niko Posted November 12, 2022 Author Share Posted November 12, 2022 5 minutes ago, Sherzod said: Hello, This post may help you: This may also be useful to me in the future. But, at the moment, I am interested in triggering an event when clicking on the tab title. Or maybe it's possible to add just a regular button to the UniTabSheet header in general? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 12, 2022 Share Posted November 12, 2022 See ClientEvents. Quote Link to comment Share on other sites More sharing options...
artem_niko Posted November 12, 2022 Author Share Posted November 12, 2022 8 minutes ago, Sherzod said: See ClientEvents. Has no one done this before? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 12, 2022 Share Posted November 12, 2022 18 minutes ago, artem_niko said: Has no one done this before? I have modified the above code (solution), try. 1. UniPageControl1.ClientEvents.ExtEvents -> function boxready(sender, width, height, eOpts) { var tab = sender; tab.getEl().on('click', function(e, target, options) { ajaxRequest(tab, '_click', ['tabIndx='+tab.tabPanel.tabBar.getRefItems().findIndex(item => item.id === target.getAttribute('data-componentid'))]); }, tab.getEl(), { preventDefault: true, delegate: '.x-tab' }); } 2. UniPageControl1.OnAjaxEvent -> procedure TMainForm.UniPageControl1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_click' then begin with (Sender as TUniPageControl) do begin CustomAttribs.Values['contextTab'] := Pages[Params.Values['tabIndx'].ToInteger()].Caption; ShowMessage(CustomAttribs.Values['contextTab'] + ' clicked...'); end; end; end; 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.