likemike Posted April 5, 2021 Share Posted April 5, 2021 Hello! I want to write a border around an image when user clicks the image. I use this on the OnClick-event: UnimImage1.JSInterface.JSConfig('cls', ['borderImg']); where "borderImg" is the corresponding CSS: .borderImg img { border: red; border-style: solid; border-width: 4px; } I get the error message: Quote Config Option: cls "borderImg"<br/> is referring a previous request, <br/> it's not allowed in AJAX request or JS handler. Use equivalent Public Property or Method instead. When I set the JSConfig on the OnCreate-event of the image, all works fine. So the question is: How can I change the CSS during runtime. Thanks in advance Mike Quote Link to comment Share on other sites More sharing options...
likemike Posted April 5, 2021 Author Share Posted April 5, 2021 My dirty solution is: do without CSS and use a an UnimImage in a UnimPanel with margins:=3 and set the panel color to red at runtime. I think, that CSS is only assignable during creation. (but maybe there is a better solution...) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 5, 2021 Share Posted April 5, 2021 1 hour ago, likemike said: I think, that CSS is only assignable during creation No. 2 hours ago, likemike said: JSConfig Should be used when initializing a component. In runtime, you can try to use JSCall, for example: with UnimImage.JSInterface do JSCall('addCls', ['borderImg']) 1 Quote Link to comment Share on other sites More sharing options...
likemike Posted April 5, 2021 Author Share Posted April 5, 2021 Thank you! This is much better!! Quote Link to comment Share on other sites More sharing options...
Fred Montier Posted April 6, 2021 Share Posted April 6, 2021 22 hours ago, likemike said: Thank you! This is much better!! 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.