EhLib.Com https://forum.ehlib.com/en/ |
|
Creating new TCombobox class inherited from "TDBComboBoxEh" https://forum.ehlib.com/en/viewtopic.php?f=5&t=1154 |
Page 1 of 1 |
Author: | Luciano_F [ 03 May 2022, 20:30 ] | ||
Post subject: | Creating new TCombobox class inherited from "TDBComboBoxEh" | ||
Hello I have a very large project that I intend to use "TDBComboBoxEh" but I would not like to change all the Class from "TComboBox" to "TDBComboBoxEh" for that I am manipulating the Class Type TComboBox = Class(DBCtrlsEh.TDBComboBoxEh) I'm having trouble setting the "ItemIndex" in the Form's OnCreate it works when clicking the button but in oncreate it doesn't work. And another thing I can't get is an "AutoWidth" from the list when opening for that I have the procedure "CB_AutoWidth" but it only works after I click on the Combobox twice And Another thing is the Sorted Method how to create it ? Grateful.
|
Author: | EhLibSupport [ 05 May 2022, 03:22 ] |
Post subject: | Re: Creating new TCombobox class inherited from "TDBComboBox |
Hello In the Unit2 TComboBox.SetItemIndex you use InternalSetItemIndex. I don't know why you used this function, but the way to fix ItemIndex property assignment error is to use ItemIndex property in the base class. Like this Code: procedure TComboBox.SetItemIndex(Value: Integer);
Begin if FItemIndex <> Value then FItemIndex := Value; // Self.InternalSetItemIndex(Value); inherited ItemIndex := Value; End; |
Author: | EhLibSupport [ 05 May 2022, 03:24 ] |
Post subject: | Re: Creating new TCombobox class inherited from "TDBComboBox |
Quote: And another thing I can't get is an "AutoWidth" from the list when opening for that I have the procedure "CB_AutoWidth" but it only works after I click on the Combobox twice Call CB_AutoWidth before inherited DropDown Code: procedure TComboBox.DropDown(AEditButton: TEditButtonEh = nil);
Begin CB_AutoWidth(Self); inherited DropDown(AEditButton); Modified := True; End; |
Author: | EhLibSupport [ 05 May 2022, 03:27 ] |
Post subject: | Re: Creating new TCombobox class inherited from "TDBComboBox |
Quote: And Another thing is the Sorted Method how to create it ? Code: procedure TForm2.Button2Click(Sender: TObject);
begin TStringList(ComboBox1.Items).Sort; end; |
Author: | Luciano_F [ 05 May 2022, 14:33 ] | ||
Post subject: | Re: Creating new TCombobox class inherited from "TDBComboBox | ||
How to save Itemindex Property ? Attached is a project where I am using "TPropStorageEh" I don't understand why I can't read the contents of "ItemIndex" I tried to create a "GetItemIndex" function but I couldn't
|
Author: | Luciano_F [ 06 May 2022, 10:57 ] |
Post subject: | Re: Creating new TCombobox class inherited from "TDBComboBox |
Luciano_F wrote: How to save Itemindex Property ? Attached is a project where I am using "TPropStorageEh" I don't understand why I can't read the contents of "ItemIndex" I tried to create a "GetItemIndex" function but I couldn't Resolution Quote: Function TComboBox.GetItemIndex : Integer;
Begin Result := inherited ItemIndex; End; |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |