Tim Posted February 11, 2015 Posted February 11, 2015 Hi, I know this question has been asked a couple of times before, but we have the problem that we would like to increase the height of a TUniComboBox beyond the 22 pixel default. Unfortunately this results in the ungainly appearance shown in the attached image, where the height of the button part of the combobox no longer matches that of the editor part. I was just wondering if anyone has come up with a workaround for this? Maybe one could hide the button part and put a TUniButton in its place which causes the list to drop down when clicked? Many thanks Tim Quote
Sherzod Posted February 11, 2015 Posted February 11, 2015 I was just wondering if anyone has come up with a workaround for this? Maybe one could hide the button part and put a TUniButton in its place which causes the list to drop down when clicked? Hi, You can... For example: 1. UniComboBox1 -> ClientEvents -> UniEvents function beforeInit(sender, config) { sender.hideTrigger = true; //sender.isExpanded = false; } 2. procedure TMainForm.UniButton1Click(Sender: TObject); begin UniSession.AddJS('MainForm.UniComboBox1.expand()'); end; But this is a quick, rough workaround! Try.. Best regards. Quote
Tim Posted February 12, 2015 Author Posted February 12, 2015 Hi, I just noticed that the reply that was posted here yesterday has been removed. Was there something wrong with the information it contained? Should i not use that code? It worked just fine in my tests Thanks, Tim Quote
Sherzod Posted February 12, 2015 Posted February 12, 2015 Hi, I just noticed that the reply that was posted here yesterday has been removed. Was there something wrong with the information it contained? Should i not use that code? It worked just fine in my tests Thanks, Tim Hi, Sorry, Now again displayed! Best regards. Quote
Tim Posted February 12, 2015 Author Posted February 12, 2015 Thanks! For what it's worth, i have attached an example of using this technique in the main form of a project. For a convincing implementation one would probably want to create a glyph for the TUniSpeedButton which looks as close as possible to a normal combobox button. To allow the combobox to toggle between the expanded and collapsed state when the button is repeatedly clicked, i record the time of the most recent combobox collapse event. In the button click event, i compare this recorded time to the current time; if the difference is <= 100 milliseconds, the combobox was probably already expanded when the button was clicked so i close it. One could probably improve on this implementation. Anyway, maybe this example will help someone ComboBox.zip 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.