Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 11 total
Thread feature request
Thu, Aug 27 2015 3:13 AMPermanent Link

Ronald

Hi Tim,

I can remember you asked for suggestions, but I can not find the message any
more so I express my wish here:
Can you add values to TComboBox?

Greetings,
Ronald
Thu, Aug 27 2015 10:09 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ronald,

<< I can remember you asked for suggestions, but I can not find the message any more so I express my wish here:
Can you add values to TComboBox? >>

Could you elaborate ?  I'm not sure what you mean by "values" here, since you can already add a list of strings (Items) to the TEditComboBox and TButtonComboBox controls.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Aug 27 2015 11:33 AMPermanent Link

Walter Matte

Tactical Business Corporation


I think he is asking for 2 lists.

One for display and one for value

Value     Display
1            No Tax
2            With Tax
3            Some Tax
.....          
Thu, Aug 27 2015 11:40 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Walter,

<< I think he is asking for 2 lists.

One for display and one for value  >>

Ahh, I thought that might be it.

This is a highly-requested feature.  In fact, I think that is one of the first component modifications that I made back in Delphi 1/2 when starting out with Delphi, so I really have no excuse for not adding it to EWB. Wink

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Aug 27 2015 12:32 PMPermanent Link

A.Kyr

I support also this very very needed feature.
But is better that the support of value be done in TStrings class as in delphi with the use of TObject?
(i mean
TStrings.addobject(AString,AnObject)
that can be used as
MyComboBox.items.addobject('No Tax',TObject(0));
)
This way it will be available in all components where TSTrings is used and much code from delphi - even not in/for GUI - could be used...

Thanks anyway for any revelant additional feature you will be added.

Regards

A.Kyriakos
Thu, Aug 27 2015 6:39 PMPermanent Link

Trinione

<<One for display and one for value
Value     Display
1            No Tax
2            With Tax
3            Some Tax
>>

I use a Grid with the value column hidden or set to Width=0

Check out this thread http://goo.gl/59fe1J
Fri, Aug 28 2015 4:44 AMPermanent Link

Ronald

That is exactly what I mean.

"Walter Matte" schreef in bericht
news:05B760CB-F416-4893-BA21-E50C4F99DFE2@news.elevatesoft.com...


I think he is asking for 2 lists.

One for display and one for value

Value     Display
1            No Tax
2            With Tax
3            Some Tax
.....
Fri, Aug 28 2015 5:31 AMPermanent Link

Ronald

That is a handy workaround, but not data-aware, so I always need extra code
for that field.

"Trinione" schreef in bericht
news:14FC4B9A-9E56-4133-8CA6-D1074B30CB5F@news.elevatesoft.com...

<<One for display and one for value
Value     Display
1            No Tax
2            With Tax
3            Some Tax
>>

I use a Grid with the value column hidden or set to Width=0

Check out this thread http://goo.gl/59fe1J
Thu, Oct 22 2015 2:36 AMPermanent Link

Petter Topp

<< This is a highly-requested feature.  In fact, I think that is one of the first component modifications that I made back in Delphi 1/2 when starting out with Delphi, so I really have no excuse for not adding it to EWB. Wink >>

Any new on this Tim?
Thu, Oct 22 2015 6:06 AMPermanent Link

A.Kyr

Petter Topp wrote:

<< This is a highly-requested feature.  In fact, I think that is one of the first component modifications that I made back in Delphi 1/2 when starting out with Delphi, so I really have no excuse for not adding it to EWB. Wink >>

I have made an inherited control. Isn't the smartest possible code but i have installed it in components's toolbox and i use it until any better solution is available

// ------------------  start
TAiasButtonComboBox = class(TButtonComboBox)
private
public
 IntArr: TAiasArrayofInteger;
 constructor create(AOwner:TComponent);  override;
 Destructor  destroy; override;
 procedure AddObject(S:String; AObj:integer);
 procedure ClearObjects;
 procedure SelectByIntValue(id:integer; Select1stIfNotFound:boolean=true);
 function  SelectedIntValue:integer;
end;

constructor TAiasButtonComboBox.create(AOwner:TComponent);
var i:integer;
begin
 inherited create(AOwner);
 SetLength(IntArr,25);
 for i:=0 to Length(IntArr)-1 do IntArr[i]:=-1;
end;

Destructor  TAiasButtonComboBox.destroy;
begin           
 SetLength(IntArr,0);
 inherited destroy;
end;

procedure TAiasButtonComboBox.AddObject(S:String; AObj:integer);
var idx,i,OldSize:integer;
begin
 idx:=items.add(s); if idx>=Length(IntArr) then begin
    OldSize:=Length(IntArr);  
    SetLength(IntArr,Length(IntArr)+25);
    for i:=OldSize to Length(IntArr)-1 do IntArr[i]:=-1;
 end;
 IntArr[idx]:=AObj;
end;

procedure TAiasButtonComboBox.ClearObjects;
var i:integer;
begin
 items.clear; Setlength(IntArr,25);
 for i:=0 to Length(IntArr)-1 do IntArr[i]:=-1;
end;

procedure TAiasButtonComboBox.SelectByIntValue(id:integer; Select1stIfNotFound:boolean=true);
var idx, i:integer;
begin                       
 i:=-1;
 for idx:=0 to Items.count-1 do begin
    if id=IntArr[idx] then begin i:=idx; ItemIndex:=i; break; end;
 end;
 if ((i=-1) and (Select1stIfNotFound)) then ItemIndex:=0;
end;

function TAiasButtonComboBox.SelectedIntValue:integer;
var idx:integer;
begin
 idx:=itemindex;  if idx=-1 then result:=-1 else result:=IntArr[idx];
end;
//----------------- end

I hope it helps

Regards

A.kyriakos
Page 1 of 2Next Page
Jump to Page:  1 2
Image