Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 Mar 2024, 16:32

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 03 May 2022, 20:30 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 88
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.


Attachments:
ehCombobox ItemIndex.7z [1.94 KiB]
Downloaded 83 times
Top
 Profile  
 
PostPosted: 05 May 2022, 03:22 
Offline

Joined: 08 May 2014, 18:06
Posts: 660
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;

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 05 May 2022, 03:24 
Offline

Joined: 08 May 2014, 18:06
Posts: 660
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;

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 05 May 2022, 03:27 
Offline

Joined: 08 May 2014, 18:06
Posts: 660
Quote:
And Another thing is the Sorted Method how to create it ?


Code:
procedure TForm2.Button2Click(Sender: TObject);
begin
  TStringList(ComboBox1.Items).Sort;
end;

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 05 May 2022, 14:33 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 88
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


Attachments:
ehCombobox ItemIndex.7z [2.08 KiB]
Downloaded 68 times
Top
 Profile  
 
PostPosted: 06 May 2022, 10:57 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 88
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;


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 59 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group