Abaksoft Posted August 28, 2020 Share Posted August 28, 2020 Hello Sherzod, 1. In Desktop mode this works fine : procedure TMainForm.UniButton1Click(Sender: TObject); begin UniLabel1.JSInterface.JSCall('setText', ['Hello']); end; 2. In Mobile Form : procedure TMainmForm.UnimButton1Click(Sender: TObject); begin UnimLabel1.JSInterface.JSCall('setText', ['Hello']); end; raise error : "...setText is not a function" How can i solve this ? Thx Link to comment Share on other sites More sharing options...
Sherzod Posted August 28, 2020 Share Posted August 28, 2020 3 minutes ago, Abaksoft said: UnimLabel1.JSInterface.JSCall('setText', ['Hello']); Hello, What if you will use... UnimLabel1.Caption := '' Link to comment Share on other sites More sharing options...
Sherzod Posted August 28, 2020 Share Posted August 28, 2020 13 minutes ago, Abaksoft said: UnimLabel1.JSInterface.JSCall('setText', ['Hello']); UnimLabel1.JSInterface.JSCall('element.setText', ['Hello']); Link to comment Share on other sites More sharing options...
Abaksoft Posted August 28, 2020 Author Share Posted August 28, 2020 13 minutes ago, Sherzod said: UnimLabel1.JSInterface.JSCall('element.setText', ['Hello']); Mmm...Thank you Sherzod, this JS works fine but not solve my problem. Infact, it's related to centring text on a moble Form. I can't get a good center after changing unimLabel1.Caption. I was thinking wrongly, to change it via JS but nothnig ?! Here is a testCase. Can you please kindly have look ? The pupose is to maintain centering even with changing caption. Thx. 1.Center_Center.7z Link to comment Share on other sites More sharing options...
Sherzod Posted August 28, 2020 Share Posted August 28, 2020 36 minutes ago, Abaksoft said: Infact, it's related to centring text on a moble Form. I can't get a good center after changing unimLabel1.Caption. UnimLabel1.JSInterface.JSCall('element.setText', ['111111 2222222222222 3333333333333333']); UnimLabel1.JSInterface.JSCall('element.setStyle', ['text-align', 'center']); Link to comment Share on other sites More sharing options...
Sherzod Posted August 28, 2020 Share Posted August 28, 2020 Seems I misunderstood you. Link to comment Share on other sites More sharing options...
Sherzod Posted August 28, 2020 Share Posted August 28, 2020 I will check. Link to comment Share on other sites More sharing options...
Sherzod Posted August 28, 2020 Share Posted August 28, 2020 3 hours ago, Abaksoft said: UnimLabel1.JSInterface.JSCall('element.setText', ['111111 2222222222222 3333333333333333']); UnimLabel1.JSInterface.JSCall('setWidth', ['auto']); 1 Link to comment Share on other sites More sharing options...
Abaksoft Posted August 28, 2020 Author Share Posted August 28, 2020 12 minutes ago, Sherzod said: UnimLabel1.JSInterface.JSCall('element.setText', ['111111 2222222222222 3333333333333333']); UnimLabel1.JSInterface.JSCall('setWidth', ['auto']); Many Thanks Maestro, I am taking a big cofee with delicious cakes with family. i will check it tomorrow ان شاء الله Cheers. 1 Link to comment Share on other sites More sharing options...
Abaksoft Posted August 29, 2020 Author Share Posted August 29, 2020 18 hours ago, Sherzod said: UnimLabel1.JSInterface.JSCall('setWidth', ['auto']); Perfect Maestro, Finally your JSCall is a good replacement of autosize methode, wich should be improved. I Opened a Ticket FSD-2381 Resume : A. Problem : UnimLabel.Autosize := True not works, if caption change at Runtime. B. Solution : UnimLabel1.JSInterface.JSCall('setWidth', ['auto']); UnimLabel1.Caption:='111111 2222222222222 3333333333333333'; 1 Link to comment Share on other sites More sharing options...
Recommended Posts