SISBLU Software Posted July 6, 2020 Posted July 6, 2020 Hello, I need Toggle Button for my application. there is only this component for mobile. How can I do for Desktop? Quote
Sherzod Posted July 6, 2020 Posted July 6, 2020 4 hours ago, Daha Software said: How can I do for Desktop? Hello, You can use this config for now: UniButton1 -> procedure TMainForm.UniFormCreate(Sender: TObject); begin UniButton1.JSInterface.JSConfig('enableToggle', [True]); end; function click(sender, e, eOpts) { alert(sender.pressed) } Quote
SISBLU Software Posted July 6, 2020 Author Posted July 6, 2020 No work. I use uni-1.90.0.1531, Theme Desketop: crisp UniButton1.JSInterface.JSConfig('enableToggle', [True]); Quote
Sherzod Posted July 6, 2020 Posted July 6, 2020 7 minutes ago, Daha Software said: Theme Desketop: crisp Does it work on other themes? Quote
Sherzod Posted July 6, 2020 Posted July 6, 2020 12 minutes ago, Daha Software said: No work. I use uni-1.90.0.1531, Theme Desketop: crisp Works for me (1534). Quote
SISBLU Software Posted July 6, 2020 Author Posted July 6, 2020 No Work in 1534. I tested on other theme also does not work Quote
SISBLU Software Posted July 6, 2020 Author Posted July 6, 2020 In Attach test. No Work for me Toggle.zip Quote
Sherzod Posted July 6, 2020 Posted July 6, 2020 7 minutes ago, Daha Software said: I tested on other theme also does not work Seems to work for you too. Quote
SISBLU Software Posted July 6, 2020 Author Posted July 6, 2020 Now I understand. It changes color only. But he doesn't look like Toggle. How do I stay like this? Quote
Sherzod Posted July 6, 2020 Posted July 6, 2020 10 minutes ago, Daha Software said: It changes color only. But he doesn't look like Toggle. Yes, for the desktop it looks like this. Quote
Sherzod Posted July 6, 2020 Posted July 6, 2020 2 hours ago, Daha Software said: How do I stay like this? It can be done by creating a custom component, I think. Quote
SISBLU Software Posted July 6, 2020 Author Posted July 6, 2020 This already exists in UNIGUI Touch. That would help a lot if it existed for DESKTOP Quote
fraxzi Posted July 7, 2020 Posted July 7, 2020 15 hours ago, Daha Software said: This already exists in UNIGUI Touch. That would help a lot if it existed for DESKTOP +1, I am also looking that kinda component too in Desktop. -Frances Quote
Wilton Ergon Posted July 7, 2020 Posted July 7, 2020 https://store.falconsistemas.com.br/?gclid=Cj0KCQjwupD4BRD4ARIsABJMmZ_QFRABkbdhoP8au95YMrweq3wkOcpc3KJa4HyzKaEVm0WHGJzfWD8aAuHQEALw_wcB here it is. Quote
Sherzod Posted July 8, 2020 Posted July 8, 2020 On 7/6/2020 at 9:15 PM, Daha Software said: This already exists in UNIGUI Touch. That would help a lot if it existed for DESKTOP 21 hours ago, fraxzi said: +1, I am also looking that kinda component too in Desktop. Hello, Simple implementation on a desktop browser. 1. MainForm.Script: Ext.define('Ext.field.Toggle', { extend: 'Ext.slider.Single', xtype: 'toggle', minValue: 0, maxValue: 1, width: 80, onRender: function(parentNode, containerIdx) { this.callParent([parentNode, containerIdx]); this.publishValue(); }, setValue: function(thumbIndex, value) { value = value ? 1 : 0; this.callParent([value]); this.bodyEl.toggleCls('x-togglefield-on', value); this.publishValue(); }, getValue: function() { return this.callParent([0]) ? true : false; } }); 2. CustomCSS: .x-togglefield-on .x-slider:before { background-color: green; } 3. UniPanel1: Caption = '' function beforeInit(sender, config) { config.layout = { type: 'vbox', padding: 5 }; config.items = [ { xtype: 'toggle', reference: 'firsttoggle', listeners: { change: function(field, newValue, oldValue) { console.log(field.reference + ' Value of this toggle has changed:', (newValue) ? 'ON' : 'OFF'); } } }, { xtype: 'toggle', reference: 'secondtoggle', listeners: { change: function(field, newValue, oldValue) { console.log(field.reference + ' Value of this toggle has changed:', (newValue) ? 'ON' : 'OFF'); } } } ] } 4. Results: Theme: Triton Theme: Crisp 5. Sources: https://fiddle.sencha.com/#view/editor&fiddle/27ac https://docs.sencha.com/extjs/7.0.0/modern/Ext.field.Toggle.html Quote
SISBLU Software Posted July 8, 2020 Author Posted July 8, 2020 Perfect. Thanks a lot for the help Quote
Harry88 Posted September 17, 2020 Posted September 17, 2020 how to get value from firsttoggle to delphi code? Quote
delagoutte Posted February 14, 2023 Posted February 14, 2023 hello, i would like this toggle look like this : but i dont find the css class that i must use for having this result. any css champion could help me ? Quote
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.