picyka Posted April 1, 2021 Share Posted April 1, 2021 How to call the whattszap no second button button, using unimSegmentButton that would be for a normal button. UniButton1.JSInterface.JSAddListener('tap', 'function(sender, e, eOpts){window.open("URL", "_blank")}'); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 1, 2021 Share Posted April 1, 2021 5 minutes ago, picyka said: How to call the whattszap no second button button, using unimSegmentButton that would be for a normal button. UniButton1.JSInterface.JSAddListener('tap', 'function(sender, e, eOpts){window.open("URL", "_blank")}'); Hello, Can you please clarify your question? Quote Link to comment Share on other sites More sharing options...
picyka Posted April 1, 2021 Author Share Posted April 1, 2021 3 minutes ago, Sherzod said: Hello, Can you please clarify your question? I have a mobile segmentnutton, in the second item I need to call the whatsapp link, when it is a normal "unimButton" button I handle this call at the tap event, how to call the tap event on a unimSegmentButtton? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 1, 2021 Share Posted April 1, 2021 13 minutes ago, picyka said: I have a mobile segmentnutton, in the second item I need to call the whatsapp link, when it is a normal "unimButton" button I handle this call at the tap event, how to call the tap event on a unimSegmentButtton? You can use OnClick event, for example: procedure TMainmForm.UnimSegmentedButton1Click(Sender: TUnimButtonItem); begin if Sender.ButtonId = 1 then begin // end; end; Quote Link to comment Share on other sites More sharing options...
picyka Posted April 1, 2021 Author Share Posted April 1, 2021 7 minutes ago, Sherzod said: You can use OnClick event, for example: procedure TMainmForm.UnimSegmentedButton1Click(Sender: TUnimButtonItem); begin if Sender.ButtonId = 1 then begin // end; end; Yes, I use it that way, but I need to call the whatsapp link, on a normal button, I would use it that way UnimButton1.JSInterface.JSAddListener ('tap', 'function (sender, e, eOpts) {window.open ("URL", "_blank")}'); how would I do this same code in unimSegmentButton? procedure TMainmForm.UnimSegmentedButton1Click (Sender: TUnimButtonItem); begin if Sender.ButtonId = 1 then begin UnimSegmentButton.Itens [1] .JSInterface.JSAddListener ('tap', 'function (sender, e, eOpts) {window.open ("URL", "_blank")}'); end; end; it would have to be something like that ... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 1, 2021 Share Posted April 1, 2021 Is this solution ok for you? procedure TMainmForm.UnimSegmentedButton1Click(Sender: TUnimButtonItem); begin if Sender.ButtonId = 1 then UniSession.BrowserWindow('http://google.com', 0, 0, '_blank') end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 1, 2021 Share Posted April 1, 2021 23 minutes ago, picyka said: UnimSegmentButton.Itens [1] .JSInterface.JSAddListener ('tap', 'function (sender, e, eOpts) {window.open ("URL", "_blank")}'); procedure TMainmForm.UnimFormReady(Sender: TObject); begin with UnimSegmentedButton1 do JSInterface.JSAddListener('tap', 'function(){window.open("URL", "_blank")}', Items[1].JSMenuItem) end; Quote Link to comment Share on other sites More sharing options...
picyka Posted April 2, 2021 Author Share Posted April 2, 2021 On 4/1/2021 at 8:45 AM, Sherzod said: procedure TMainmForm.UnimFormReady(Sender: TObject); begin with UnimSegmentedButton1 do JSInterface.JSAddListener('tap', 'function(){window.open("URL", "_blank")}', Items[1].JSMenuItem) end; Thank you very much. Quote Link to comment Share on other sites More sharing options...
picyka Posted June 9, 2021 Author Share Posted June 9, 2021 with Self.pmOpcoesMenu,JSInterface do JSAddListener('click', JSFunction('sender', 'var textarea = document.getElementById(' + UniMemoCopyMenu.JSName + '.inputId); ' + 'textarea.select(); ' + 'document.execCommand(''copy'');'), Self.pmCopiarMenu.JSMenuItem); pmOpcoesMenu = TUniPopupMenu I tried to follow this path but it didn't work, any opinion? Quote Link to comment Share on other sites More sharing options...
picyka Posted June 9, 2021 Author Share Posted June 9, 2021 48 minutes ago, picyka said: with Self.pmOpcoesMenu,JSInterface do JSAddListener('click', JSFunction('sender', 'var textarea = document.getElementById(' + UniMemoCopyMenu.JSName + '.inputId); ' + 'textarea.select(); ' + 'document.execCommand(''copy'');'), Self.pmCopiarMenu.JSMenuItem); pmOpcoesMenu = TUniPopupMenu I tried to follow this path but it didn't work, any opinion? procedure TMainForm.UniFormReady(Sender: TObject); begin Self.UniMemoCopyMenu.Left := -10; with TXUniPopupMenu(Self.pmOpcoesMenu),JSInterface do JSAddListener('click', JSFunction('sender', 'var textarea = document.getElementById(' + UniMemoCopyMenu.JSName + '.inputId); ' + 'textarea.select(); ' + 'document.execCommand(''copy'');'), Self.pmCopiarMenu.JSMenuItem); end; I managed to solve it that way, but I noticed that I need to have the UniMemo visible true, there is some way out for that. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 9, 2021 Share Posted June 9, 2021 7 minutes ago, picyka said: I managed to solve it that way, but I noticed that I need to have the UniMemo visible true, there is some way out for that. Hello, Could you please clarify your case? Quote Link to comment Share on other sites More sharing options...
picyka Posted June 9, 2021 Author Share Posted June 9, 2021 10 minutes ago, Sherzod said: Hello, Could you please clarify your case? yes, note that it only works if uniMemo is visible true testCase.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 9, 2021 Share Posted June 9, 2021 3 minutes ago, picyka said: yes, note that it only works if uniMemo is visible true Please explain briefly what do you want to achieve? Quote Link to comment Share on other sites More sharing options...
picyka Posted June 9, 2021 Author Share Posted June 9, 2021 Dois minutos atrás, Sherzod disse: Por favor, explique brevemente o que você quer alcançar? Consegui fazer o que queria, mas tive que deixar o memorando sempre visível verdadeiro, para que não aparecesse na tela, eu fiz assim. Self.UniMemoCopyMenu.Left := -200; although the copy could work even with the visible = false memo 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.