Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 19 Feb 2020, 22:32

All times are UTC




Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 21 Jan 2020, 21:30 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 31
I have the following code:

but how to use it I need to have two columns in a combobox and with this event I do


procedure TForm1.Proc_ComboBoxColumnsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
Columns: TStringDynArray;
ColCount, I: Integer;
ItemText: string;
DC: HDC;
DrawRect: TRect;
Middle: Integer;
begin
ItemText := TCombobox(Control).Items[Index];
Columns := SplitString(ItemText, '|');
ColCount := Length(Columns);

if ColCount = 0 Then
Exit;

DC := TCombobox(Control).Canvas.Handle;
TCombobox(Control).Canvas.FillRect(Rect);

Middle := Rect.Left + Rect.Width div ColCount;
TCombobox(Control).Canvas.MoveTo(Middle, Rect.Top);
TCombobox(Control).Canvas.LineTo(Middle, Rect.Bottom);

For I := 2 To ColCount - 1 Do Begin
Middle := Rect.Left + ((Rect.Width div ColCount) * I);
TCombobox(Control).Canvas.MoveTo(Middle, Rect.Top);
TCombobox(Control).Canvas.LineTo(Middle, Rect.Bottom);
End;

if ColCount > 0 then begin
DrawRect := Rect;
OffsetRect(DrawRect, 1, 0);
DrawRect.Right := DrawRect.Right - ((DrawRect.Width div ColCount));
DrawTexT(DC, Columns[0], Length(Columns[0]), DrawRect, 0);
end;

For I := 1 To ColCount - 1 Do Begin
if ColCount > I then begin
DrawRect := Rect;
OffsetRect(DrawRect, 1, 0);
DrawRect.Left := DrawRect.Left + ((DrawRect.Width div ColCount) * I);
DrawTexT(DC, Columns[I], Length(Columns[I]), DrawRect, 0);
End;
End;

end;


Top
 Profile  
 
PostPosted: 23 Jan 2020, 14:20 
Offline

Joined: 08 May 2014, 18:06
Posts: 364
Hello

DbComboboxEh doesn't support multicolumns in the dropdown box.

Why don't you use the TDBLookupComboboxEh component.
It supports several columns in the dropdown box.


Attachments:
sshot-69.png
sshot-69.png [ 52.79 KiB | Viewed 109 times ]
sshot-70.png
sshot-70.png [ 37.71 KiB | Viewed 109 times ]

_________________
Best regards
EhLib Support Team
Top
 Profile  
 
PostPosted: 23 Jan 2020, 17:48 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 31
I don't have access to the Database for these columns, it would be system settings only.

   Another thing would be to do incremental searches for the example sentence:
  1 João da Silva
  2 Mariana Gold

I would just type "Silva" and he could find it on the list.


Top
 Profile  
 
PostPosted: 23 Jan 2020, 23:09 
Offline

Joined: 08 May 2014, 18:06
Posts: 364
Hello

Quote:
I don't have access to the Database for these columns, it would be system settings only.

You can use ClientDataSet or MemTableEh. They can work without DataBase. Keeps all data in Memory.

Quote:
Another thing would be to do incremental searches for the example sentence:

Yes, it can filter and search in the DropDownBox

Attachment:
sshot-71.png
sshot-71.png [ 23.31 KiB | Viewed 107 times ]


Read "Advanced Configuration of a drop-down list in Comboboxes" in the "EhLib Users Guide.doc"

Here is a Demo porject


Attachments:
2020-01-24-DBLookupComboboxEh-SimpleList2Columns.zip [2.52 KiB]
Downloaded 2 times

_________________
Best regards
EhLib Support Team
Top
 Profile  
 
PostPosted: 23 Jan 2020, 23:45 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 31
Hello i can't use
TDBLookupComboboxEh
Too many tcombobox components could you place partial search on tcombobox?
Or how could I override the tcomboboxEh class for it to have this functionality.


Top
 Profile  
 
PostPosted: 24 Jan 2020, 00:14 
Offline

Joined: 08 May 2014, 18:06
Posts: 364
Hello
The drop-down list in DbComboboxEh does not support many things.
It’s easier to write a new component than to add these features to the current DbComboboxEh.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 24 Jan 2020, 11:15 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 31
the "DbComboboxEh" component already has a property called "CaseInsensitiveTextSearch"
that when filling in "KeyItems" already does a search but does not do partial, I believe it would just be to change the internal method related to
"CaseInsensitiveTextSearch"


Top
 Profile  
 
PostPosted: 24 Jan 2020, 15:42 
Offline

Joined: 08 May 2014, 18:06
Posts: 364
Hello.

Now you write only about the searching (and filtering in DbComboboxEh), and no longer consider the requirement for several columns.

What about the multi-columns proposal?

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 24 Jan 2020, 17:24 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 31
I managed to solve the issue of several columns creating a Form with a TListView and when I need several columns I call this Form with TListView through a procedure.

However, the partial search was not successful.


Top
 Profile  
 
PostPosted: 28 Jan 2020, 11:52 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 31
Up


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


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