Jump to content

UnimSegmentButton


picyka

Recommended Posts

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

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 ...

Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 months later...
  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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...