indent list in combobox
Started by emailaya, Dec 24 2006 11:00 PM
9 replies to this topic
#1
Posted 24 December 2006 - 11:00 PM
if i chose dmindentlist in displaymode
then in DrawItem procedure:
dmIndentList:
begin
Indent := StrToInt(FItems.Names[Index]) * 10;
AText := GetValueFromIndex(Index);
Inc(TxtRect.Left, Indent);
end;
i fail with '' is not a valid integer value in line: Indent := StrToInt(FItems.Names[Index]) * 10;
that is when the item is ''
also if i add a glyph, it covers the beginning of the text of the combobox
then in DrawItem procedure:
dmIndentList:
begin
Indent := StrToInt(FItems.Names[Index]) * 10;
AText := GetValueFromIndex(Index);
Inc(TxtRect.Left, Indent);
end;
i fail with '' is not a valid integer value in line: Indent := StrToInt(FItems.Names[Index]) * 10;
that is when the item is ''
also if i add a glyph, it covers the beginning of the text of the combobox
#2
Posted 25 December 2006 - 01:58 AM
Hi emailaya
As it's my idea to add this feature here some comments:
The indentlist is based on the names & items values principle of the TStrings. An empty item will violate that so isn't allowed. If you enter a item without a '=' sign the names & values arrays will error anyway deep insize the Borland RTL. The same holds for the nameslist/valuelist mode btw.
So it only works if you correctly add data to the items, emty items are not allowed. Other than one with a = sign and a number, I don't have delphi at hand at the moment but if you might experiment with an empty item like '=0' or '0='. The TStrings should however support it.
As it's my idea to add this feature here some comments:
The indentlist is based on the names & items values principle of the TStrings. An empty item will violate that so isn't allowed. If you enter a item without a '=' sign the names & values arrays will error anyway deep insize the Borland RTL. The same holds for the nameslist/valuelist mode btw.
So it only works if you correctly add data to the items, emty items are not allowed. Other than one with a = sign and a number, I don't have delphi at hand at the moment but if you might experiment with an empty item like '=0' or '0='. The TStrings should however support it.
G.W. van der Vegt
#3
Posted 25 December 2006 - 09:08 AM
hi
ok
and what about the glyph that covers the beginning of the text?
(not connected to the indent issue)
ok
and what about the glyph that covers the beginning of the text?
(not connected to the indent issue)
#4
Posted 25 December 2006 - 05:29 PM
Hi,
I never used glyphs so they escaped my attention I guess. A simple workaround would be to add 1 or 2 to all idents (it does not have to start at 0)
Btw I think a extra test for empty lines would not hurt (and just treat them as =0).
QUOTE (emailaya @ Dec 25 2006, 09:08 AM) <{POST_SNAPBACK}>
and what about the glyph that covers the beginning of the text?
(not connected to the indent issue)
(not connected to the indent issue)
I never used glyphs so they escaped my attention I guess. A simple workaround would be to add 1 or 2 to all idents (it does not have to start at 0)
Btw I think a extra test for empty lines would not hurt (and just treat them as =0).
G.W. van der Vegt
#5
Posted 25 December 2006 - 05:45 PM
u mean to add spaces in the beginning of each item?
so the glyph will cover the spaces?
ofcourse this is a wrokaround
but it will be fixed, right?
so the glyph will cover the spaces?
ofcourse this is a wrokaround
but it will be fixed, right?
#6
Posted 25 December 2006 - 06:07 PM
Hi
Here some changes that help solve the '=' problem.
In NxEdit.pas unify the output if there isn't an '=' sign by returning the item as value and '' as name instead of removing the first letter (standard TStrings behavior):
In NxPopUpControl change the following in TNxPopupList.Drawitem:
As for the Glyps, this is a NxComboBox problem and not related to the DisplayMode at all. The Images property works fine btw (but only in the dropdown part).
Here some changes that help solve the '=' problem.
In NxEdit.pas unify the output if there isn't an '=' sign by returning the item as value and '' as name instead of removing the first letter (standard TStrings behavior):
CODE
function TNxComboBox.GetItemValue: string;
begin
if (Items.Count > 0) and InRange(ItemIndex, 0, Pred(Items.Count)) then
begin
if (Pos('=',Items[ItemIndex])=0) then //veg
Result := Items[ItemIndex] //veg
else
Result := GetValueFromIndex(ItemIndex)
end
else Result := '';
end;
begin
if (Items.Count > 0) and InRange(ItemIndex, 0, Pred(Items.Count)) then
begin
if (Pos('=',Items[ItemIndex])=0) then //veg
Result := Items[ItemIndex] //veg
else
Result := GetValueFromIndex(ItemIndex)
end
else Result := '';
end;
In NxPopUpControl change the following in TNxPopupList.Drawitem:
CODE
dmIndentList:
begin
if (Pos('=',FItems[Index])=0) then //veg
begin
Indent:=0; //veg
AText:=FItems[Index]; //veg
end
else
begin
Indent := StrToInt(FItems.Names[Index]) * 10;
AText := GetValueFromIndex(Index);
end;
Inc(TxtRect.Left, Indent)
begin
if (Pos('=',FItems[Index])=0) then //veg
begin
Indent:=0; //veg
AText:=FItems[Index]; //veg
end
else
begin
Indent := StrToInt(FItems.Names[Index]) * 10;
AText := GetValueFromIndex(Index);
end;
Inc(TxtRect.Left, Indent)
As for the Glyps, this is a NxComboBox problem and not related to the DisplayMode at all. The Images property works fine btw (but only in the dropdown part).
G.W. van der Vegt
#7
Posted 25 December 2006 - 06:19 PM
Hi,
Now hope Boki picks up this code and incorporates it (I tested it and it seems ok).
As for the Glyphs, it seems like they're never taken care of in the paint handler of the edit field.
This is clearly a bug to be fixed.
Now hope Boki picks up this code and incorporates it (I tested it and it seems ok).
As for the Glyphs, it seems like they're never taken care of in the paint handler of the edit field.
This is clearly a bug to be fixed.
G.W. van der Vegt
#8
Posted 25 December 2006 - 06:51 PM
thanks allot
i hope boki will take care of it (both issues)
for next release
i hope boki will take care of it (both issues)
for next release
#9
Posted 29 January 2007 - 09:11 PM
Hi Boki,
You seem to have overlooked this bugfix in v3.9.7!
QUOTE (emailaya @ Dec 25 2006, 06:51 PM) <{POST_SNAPBACK}>
i hope boki will take care of it (both issues) for next release
You seem to have overlooked this bugfix in v3.9.7!
G.W. van der Vegt
#10
Posted 29 January 2007 - 09:57 PM
i really hope boki has a organized todo list and bug fixes
i think that the priority (and correct me if im wrong) is as following:
bug of a basic feature of a component
other bugs
new features
new components
sometimes it seems the priority is different than the above
i think that the priority (and correct me if im wrong) is as following:
bug of a basic feature of a component
other bugs
new features
new components
sometimes it seems the priority is different than the above
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











