Make Combobox readonly for editing lazarus / 31-LCL ---------------------------------------------------------------------- mangakissa · 2020-04-08 10:52 In Version 2.x TCombobox.readonly is depreciated. Using TCombobox.style is required. But property style doesn't make my combobox readonly. If a form starts and it should be in edit mode (it my case it means the combobox is readonly) I can do nothing with the combobox. Even the events oncloseup are not responding. So How do I make my combobox really readonly ? ---------------------------------------------------------------------- zeljko · 2020-04-08 11:03 Yes, property ReadOnly is removed some time ago but I really don't know exact reason. You'll need to hack into combo editor and set it read only manually. eg with Qt/Qt5 widgetsets TQtComboBox(ComboBox1.Handle).LineEdit.setReadOnly(True) works fine. ---------------------------------------------------------------------- mangakissa · 2020-04-08 11:13 I changed te readonly to enable. Now I get the same result. I see in my old application I forgot the compontent to set it readonly in 'edit' mode. Stupid me ---------------------------------------------------------------------- sstvmaster · 2020-04-08 11:24 Set: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ComboBox1.Style := csOwnerDrawFixed; // or csDropDownList or csOwnerDrawVariablethen its readonly! ---------------------------------------------------------------------- jamie · 2020-04-08 12:06 Really?  I thought that was only to not have variable sized dropped down list box entries and Edit box.. There is a OnMeasureItem event for variable, otherwise its fixed sized...  don't remember it effecting the editing options..  I retract what I said, I can't believe Delphi would change that order. it makes no sense at all, so what happens if I decide to want to optionally make the combobox editable at will at runtime, have anyone changed the style at runtime to see the effects ? ---------------------------------------------------------------------- wp · 2020-04-08 12:45 What is meant with "editing" here? The possibility to type text immediately into the control, like is done with a TEdit? Here the styles csDropDownList, csOwnerDrawFixed, csOwnerDrawVariable can be selected to prevent this. And in fact, the property "ReadOnly" switches to an unchangeable "true" state in this case. Or the possibility to change the selection? Here, I can imagine only to prevent a change by code which memorizes the ItemIndex in the OnDropDown event and restores it in the OnChange event - there is a short flicker showing the changed ItemIndex, though. ---------------------------------------------------------------------- jamie · 2020-04-08 13:45 What I meant was I toggle the READ only property so not to allow editing at times where it should not be changed..  Since Delphi now as taken the pose of removing the READ Only property has any one tested the behavior of  The Combobox switching between these modes at runtime ?  Obviously now we need to change the style property to achieve this and I do make ownerdraw comboxs due to special editing and viewing options. ---------------------------------------------------------------------- lucamar · 2020-04-08 14:11 Quote from: jamie on April 08, 2020, 02:06:28 pm I retract what I said, I can't believe Delphi would change that order. it makes no sense at all, so what happens if I decide to want to optionally make the combobox editable at will at runtime, have anyone changed the style at runtime to see the effects ? For those case you have the styles: Code: [Select]csOwnerDrawEditableFixed, csOwnerDrawEditableVariableI have never used them, though, so I don't know how well (or if) they work. ---------------------------------------------------------------------- jamie · 2020-04-08 14:24 Yes my point was has anyone tried changing those styles at runtime to make the box non or editable  ? ---------------------------------------------------------------------- wp · 2020-04-08 15:37 Quote from: lucamar on April 08, 2020, 04:11:08 pmCode: [Select]csOwnerDrawEditableFixed, csOwnerDrawEditableVariableI have never used them, though, so I don't know how well (or if) they work. These styles are "editable" like csDropdown or csSimple: you can type text like in a TEdit. In addition they have the feature that the dropdown lines can be customdrawn. They work (at least on Windows - I just tested it). ---------------------------------------------------------------------- zeljko · 2020-04-08 16:48 Quote from: wp on April 08, 2020, 05:37:54 pmQuote from: lucamar on April 08, 2020, 04:11:08 pmCode: [Select]csOwnerDrawEditableFixed, csOwnerDrawEditableVariableI have never used them, though, so I don't know how well (or if) they work. These styles are "editable" like csDropdown or csSimple: you can type text like in a TEdit. In addition they have the feature that the dropdown lines can be customdrawn. They work (at least on Windows - I just tested it). csOwnerDrawEditableFixed & csOwnerDrawEditableVariable works in Qt/Qt5 too ... EDIT: and gtk2 too ...