alfr Posted April 6, 2019 Share Posted April 6, 2019 Hi, Still a newbie when it comes to javascript and ClientEvents... (Would appreciate some help from Serzod/DD or somebody else) I've a form with a lot of TUniPanels (created dynamically with InsertControl. Layout=Table). On the panels are many tUniCheckboxes placed. As there are so many checkboxes I would like to change the background color on the parent TD when the checkbox is checked and cleared when the checkbox is not checked. See example where I've manually set one TD to background-color lightskyblue. How can this be done with javascript and ClientEvents? (I suppose I need to add a javascript function that is called onchange or onchangevalue, but I'm not able to get the parentNode correctly etc..) There are also other functions that dynamically checks/unchecks the checkboxes, so important that the ClientEvent not only responds on onclick, but also when the other functions checks/unchecks. Unigui version uni-1.70.0.1489 (desktop). Link to comment Share on other sites More sharing options...
Sherzod Posted April 6, 2019 Share Posted April 6, 2019 Hello, 3 hours ago, alfr said: where I've manually set one TD to background-color lightskyblue. Is this acceptable to you? 1. procedure ChBoxsChange(Sender: TObject); procedure TMainForm.ChBoxsChange(Sender: TObject); begin if (Sender as TUniCheckBox).Checked then (Sender as TUniCheckBox).Color := $00F9CD87 else (Sender as TUniCheckBox).Color := clNone end; 2. How to use, for example: procedure TMainForm.UniFormCreate(Sender: TObject); begin UniCheckBox1.OnChange := ChBoxsChange; UniCheckBox2.OnChange := ChBoxsChange; DynamicCheckBox.OnChange := ChBoxsChange; end; Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now