Roberto Nicchi Posted June 22, 2021 Share Posted June 22, 2021 Is it possible to avoid the Tunitoolbutton get the focus when clicked ? The focus must remain in the currently focused control. Thanks. Roberto Quote Link to comment Share on other sites More sharing options...
M.Ammar Posted June 22, 2021 Share Posted June 22, 2021 Hi Try setting focus onClick UniEdit.JSInterface.JSCall('focus', []); regards Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted June 22, 2021 Author Share Posted June 22, 2021 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 Quote Link to comment Share on other sites More sharing options...
x11 Posted June 22, 2021 Share Posted June 22, 2021 Maybe TUniSpeedButton? Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted June 22, 2021 Author Share Posted June 22, 2021 23 minutes ago, x11 said: Maybe TUniSpeedButton? I was thinking the same but unfortunately i see that the TUniSpeedButton get the focus either. Quote Link to comment Share on other sites More sharing options...
x11 Posted June 23, 2021 Share Posted June 23, 2021 And if you use the label (TUniLabel) instead of the button? Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted June 23, 2021 Author Share Posted June 23, 2021 22 minutes ago, x11 said: And if you use the label (TUniLabel) instead of the button? Thanks but the TUniLabel component doesn't have an icon and i need it. I'll make a request to add a FOCUSABLE property for the Tunitoolbutton component (and for the TUniSpeedButton). Quote Link to comment Share on other sites More sharing options...
x11 Posted June 23, 2021 Share Posted June 23, 2021 1 hour ago, Roberto Nicchi said: TUniLabel component doesn't have an icon 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; Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted June 23, 2021 Author Share Posted June 23, 2021 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; 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. Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted June 23, 2021 Share Posted June 23, 2021 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(); } Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted June 23, 2021 Author Share Posted June 23, 2021 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 ... Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted June 23, 2021 Share Posted June 23, 2021 1 hour ago, Roberto Nicchi said: Hello, i have tryed this (copyed and past both JS events) but seems have no effect ... Please send your test case. It is working in my end Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted June 23, 2021 Author Share Posted June 23, 2021 1 minute ago, Hayri ASLAN said: Please send your test case. It is working in my end I'll do it ASAP thanks Roberto Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 23, 2021 Share Posted June 23, 2021 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()})}); } 3 Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted June 23, 2021 Author Share Posted June 23, 2021 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! 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.