dpfmp Posted January 15, 2019 Share Posted January 15, 2019 Hi, I am trying to disable an item (index 3) from a uniradiogroup with this code found here ( from Sherzod ) dated october 2017: UniRadioGroup1.JSInterface.JSAssign('radioGroup.items.getAt(3).disabled', [True]) It does not seem to be doing anything here with the latest version. Is there anything else I can try? Thank you again. Delphi 10.1 UniGui 1.50.0.1484 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 15, 2019 Share Posted January 15, 2019 27 minutes ago, dpfmp said: I am trying to disable an item (index 3) from a uniradiogroup with this code found here ( from Sherzod ) dated october 2017: UniRadioGroup1.JSInterface.JSAssign('radioGroup.items.getAt(3).disabled', [True]) It does not seem to be doing anything here with the latest version. Is there anything else I can try? Hi, Use like this: UniRadioGroup1.JSInterface.JSCall('radioGroup.items.getAt(3).setDisabled', [True]); And remember that the index is Zero-based. Quote Link to comment Share on other sites More sharing options...
dpfmp Posted January 15, 2019 Author Share Posted January 15, 2019 Thank you Sherzod, It still doesn't do anything. procedure TMainForm.UniButton1Click(Sender: TObject); begin UniRadioGroup1.JSInterface.JSAssign('radioGroup.items.getAt(3).setDisabled', [True]); end; I have a UniRadioGroup with 10 items ( 0.. 9) set a design time.. If i click the button, I still can select all the items. Chrome V71 Firefox V65 Denis Prince Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 15, 2019 Share Posted January 15, 2019 JSCall instead of JSAssign Quote Link to comment Share on other sites More sharing options...
dpfmp Posted January 15, 2019 Author Share Posted January 15, 2019 Sorry. It does work. Thanks again Quote Link to comment Share on other sites More sharing options...
Bruno Ruiz Posted March 15, 2019 Share Posted March 15, 2019 On 1/15/2019 at 4:57 PM, Sherzod said: Hi, Use like this: UniRadioGroup1.JSInterface.JSCall('radioGroup.items.getAt(3).setDisabled', [True]); And remember that the index is Zero-based. Hi, I would like to know how I would check if a TUniRadioGroup item is enabled. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 15, 2019 Share Posted March 15, 2019 20 minutes ago, Bruno Ruiz said: Hi, I would like to know how I would check if a TUniRadioGroup item is enabled. Hello, Can you please specify which edition and build of UniGUI are you using? Quote Link to comment Share on other sites More sharing options...
Bruno Ruiz Posted March 15, 2019 Share Posted March 15, 2019 1 hour ago, Sherzod said: Hello, Can you please specify which edition and build of UniGUI are you using? FMSoft uniGUI Complete Edition 1.50.0.480 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 15, 2019 Share Posted March 15, 2019 2 minutes ago, Bruno Ruiz said: FMSoft uniGUI Complete Edition 1.50.0.480 Please adjust your forum email address: Quote Link to comment Share on other sites More sharing options...
Bruno Ruiz Posted March 15, 2019 Share Posted March 15, 2019 Okay, I'll do it now! Thank you very much Quote Link to comment Share on other sites More sharing options...
DEV_THS Posted March 15, 2019 Share Posted March 15, 2019 2 hours ago, Sherzod said: Please adjust your forum email address: Hello Sherzod, this is Bruno Ruiz, we registered the account as you requested, and we will use this account as of now ... could we help us with how to check if a TUniRadioGroup item is enabled? Thank you! Quote Link to comment Share on other sites More sharing options...
DEV_THS Posted March 20, 2019 Share Posted March 20, 2019 Hi, I would like to know how I would check if a TUniRadioGroup item is enabled. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 20, 2019 Share Posted March 20, 2019 16 minutes ago, DEV_THS said: Hi, I would like to know how I would check if a TUniRadioGroup item is enabled. Hi, Sorry for the late reply. Can you create an array (the size of which is equal to the count of items) on the server side and set and get the values depending on the execution of the JS code?! Quote Link to comment Share on other sites More sharing options...
DEV_THS Posted March 20, 2019 Share Posted March 20, 2019 11 minutes ago, Sherzod said: Hi, Sorry for the late reply. Can you create an array (the size of which is equal to the count of items) on the server side and set and get the values depending on the execution of the JS code?! 266/5000 Hi, it's okay ... thanks for the reply! I'm starting, could you give me a simple example of how to proceed this way? Need to do something like this in VCL procedure TUniform1.radioGroup2Click(Sender: TObject); begin radioGroup1.Buttons [0] .Enabled: = radioGroup1.Buttons [0] .Enabled and MyCondition; end; Quote Link to comment Share on other sites More sharing options...
DEV_THS Posted March 22, 2019 Share Posted March 22, 2019 could you give me an example of how to solve this problem? procedure TUniform1.radioGroup2Click(Sender: TObject); begin radioGroup1.Buttons [0] .Enabled: = radioGroup1.Buttons [0] .Enabled and MyCondition; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 22, 2019 Share Posted March 22, 2019 44 minutes ago, DEV_THS said: could you give me an example of how to solve this problem? procedure TUniform1.radioGroup2Click(Sender: TObject); begin radioGroup1.Buttons [0] .Enabled: = radioGroup1.Buttons [0] .Enabled and MyCondition; end; Something like this: 1. private { Private declarations } FButtonsArray: array of Boolean; 2. procedure TMainForm.UniFormCreate(Sender: TObject); var I: Integer; begin SetLength(FButtonsArray, UniRadioGroup1.Items.Count); for I := Low(FButtonsArray) to High(FButtonsArray) do FButtonsArray[I] := True; end; 3. procedure TMainForm.UniButton2Click(Sender: TObject); begin UniRadioGroup1.JSInterface.JSCall('radioGroup.items.getAt(3).setDisabled', [True]); FButtonsArray[3] := False; end; 4. procedure TMainForm.UniButton3Click(Sender: TObject); begin if FButtonsArray[3] then ShowMessage('True') else ShowMessage('False'); end; Quote Link to comment Share on other sites More sharing options...
DEV_THS Posted March 22, 2019 Share Posted March 22, 2019 4 hours ago, Sherzod said: Something like this: 1. private { Private declarations } FButtonsArray: array of Boolean; 2. procedure TMainForm.UniFormCreate(Sender: TObject); var I: Integer; begin SetLength(FButtonsArray, UniRadioGroup1.Items.Count); for I := Low(FButtonsArray) to High(FButtonsArray) do FButtonsArray[I] := True; end; 3. procedure TMainForm.UniButton2Click(Sender: TObject); begin UniRadioGroup1.JSInterface.JSCall('radioGroup.items.getAt(3).setDisabled', [True]); FButtonsArray[3] := False; end; 4. procedure TMainForm.UniButton3Click(Sender: TObject); begin if FButtonsArray[3] then ShowMessage('True') else ShowMessage('False'); end; I understood, I imagined something like this, but I thought I could have something simpler ... but solves my problem, thank you very much for Sherzod's attention and sorry for the inconvenience. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 22, 2019 Share Posted March 22, 2019 OK, no problem Thank you Quote Link to comment Share on other sites More sharing options...
DEV_THS Posted March 27, 2019 Share Posted March 27, 2019 On 3/22/2019 at 2:53 PM, Sherzod said: OK, no problem Thank you Hi Sherzod, how are you? I believe that I came across a bug, could you help me? I have a method in which I rename run-time items from a UniRadioGroup but I noticed that when I rename this item, and try to disable any item by its index, this command is not matched. I already have in my form a rgOrdem = TuniRadioGroup created in Design with 3 items. and at some point I call my method EnableOrdenacao; example: procedure TUniForm1.EnableOrdenacao; begin rgOrdem.Items [0]: = 'By Description'; rgOrdem.Items [1]: = 'By Code'; rgOrdem.Items [2]: = 'By Date'; case rgTypeRelatory.ItemIndex of 7.8: begin if rgTypeReport.ItemIndex = 8 then rgOrdem.Items [0]: = 'By Business Name'; rgOrdem.Items [1]: = 'By Code Desc.'; rgOrdem.JSInterface.JSCall ('radioGroup.items.getAt (' + IntToStr (2) + '). setDisabled', [True]); end; end end; Thank you! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 27, 2019 Share Posted March 27, 2019 Hi, I'm fine, thank you. How are you? OK I will check. Quote Link to comment Share on other sites More sharing options...
DEV_THS Posted March 27, 2019 Share Posted March 27, 2019 20 minutes ago, Sherzod said: Hi, I'm fine, thank you. How are you? OK I will check. I'm fine thank God, thank you for asking! Allright, I'll be waiting, thank you! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 27, 2019 Share Posted March 27, 2019 16 minutes ago, DEV_THS said: I'll be waiting Try with defer: ... rgOrdem.Items[1] := 'By Code Desc.'; rgOrdem.JSInterface.JSCode('Ext.defer(function(){'#1'.radioGroup.items.getAt(' + IntToStr (2) + ').setDisabled(true)}, 100);'); ... Quote Link to comment Share on other sites More sharing options...
DEV_THS Posted March 27, 2019 Share Posted March 27, 2019 13 minutes ago, Sherzod said: Try with defer: ... rgOrdem.Items[1] := 'By Code Desc.'; rgOrdem.JSInterface.JSCode('Ext.defer(function(){'#1'.radioGroup.items.getAt(' + IntToStr (2) + ').setDisabled(true)}, 100);'); ... Cool, it worked ... Thank you Sherzod for your help and for the speed ... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 27, 2019 Share Posted March 27, 2019 Thank you 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.