Jump to content

Tunitoolbutton non focusable. Possible ?


Roberto Nicchi

Recommended Posts

2 minutes ago, M.Ammar said:

Hi

Try setting focus  onClick

 UniEdit.JSInterface.JSCall('focus', []);

regards

 

 

Not sure to understand. I guess Uniedit is a specific component. I want the focus remain in the current component.

I work with frames. I have a base frame with only a toolbar and some buttons. All the other frames are inherited by this frame.

thanks

Link to comment
Share on other sites

32 minutes ago, x11 said:

Use fontawesome

https://fontawesome.com/v5.15/icons?d=gallery&p=2&s=regular,solid&m=free


UniLabel1.Caption := '<i class="far fa-address-card"></i> this is a TUniLabel1';
UniLabel1.TextConversion := txtHTML;

 

 

Screenshot_3.jpg

Screenshot_4.jpg

This could be a solution. I'll take a look. Thanks. Anyway i think a property in the button to make it not focusable could be very handy.

Link to comment
Share on other sites

23 hours ago, Roberto Nicchi said:

Is it possible to avoid the Tunitoolbutton get the focus when clicked ? The focus must remain in the currently focused control.

Thanks.

Roberto

One possible solution:

 

UniToolButton -> ClientEvents -> ExtEvents -> mousedown

function mousedown(sender, x, y, eOpts)
{
  ActiveCmp = Ext.get(Ext.Element.getActiveElement());
}

UniToolButton -> ClientEvents -> ExtEvents -> click

function click(sender, e, eOpts)
{
  ActiveCmp.focus();
}

 

Link to comment
Share on other sites

28 minutes ago, Hayri ASLAN said:

One possible solution:

 

UniToolButton -> ClientEvents -> ExtEvents -> mousedown


function mousedown(sender, x, y, eOpts)
{
  ActiveCmp = Ext.get(Ext.Element.getActiveElement());
}

UniToolButton -> ClientEvents -> ExtEvents -> click


function click(sender, e, eOpts)
{
  ActiveCmp.focus();
}

 

Hello, i have tryed this (copyed and past both JS events) but seems have no effect ...

Link to comment
Share on other sites

On 6/22/2021 at 5:41 PM, Roberto Nicchi said:

Is it possible to avoid the Tunitoolbutton get the focus when clicked ? The focus must remain in the currently focused control.

Hello,

Also try this approach.

UniToolBar -> ClientEvents -> ExtEvents ->

function afterrender(sender, eOpts)
{
    sender.query('button').forEach(function(btn){btn.getEl().dom.addEventListener('mousedown', function(e){e.preventDefault()})});
}

 

  • Like 3
Link to comment
Share on other sites

59 minutes ago, Sherzod said:

Hello,

Also try this approach.

UniToolBar -> ClientEvents -> ExtEvents ->



function afterrender(sender, eOpts)
{
    sender.query('button').forEach(function(btn){btn.getEl().dom.addEventListener('mousedown', function(e){e.preventDefault()})});
}

 

Five stars for this reply :) it works. Thanks a lot!

  • Like 1
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...