Jump to content


Photo

NxCheckComboBox6, Name/Value items


  • Please log in to reply
4 replies to this topic

#1 stefanw

stefanw
  • Members
  • 17 posts

Posted 18 April 2017 - 06:14 PM

Hi,

How I can prevent to show the name part of the items in value of a NxCheckComboBox6?

 

Attached File  NxCheckComboBox6.GIF   12.32KB   0 downloads

 

In the dropdown list the name/value pair is shown correct.

DisplayMode = dmIndentlist or dmValue is equal.

 

Thanks, Stefan



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,569 posts
  • Gender:Male

Posted 19 April 2017 - 09:19 PM

Hi,

Try to update next procedure:

procedure TNxCheckComboBox6.UpdateText;
var
  i: Integer;
  s: WideString;
begin
  s := EmptyStr;

  for i := 0 to Pred(Items.Count) do
    if State[i] = cbChecked then
    begin
      if s <> EmptyStr then s := s + Delimiter;
//      s := s + Items[i]; 
      s := s + GetDisplayText(i); // <--- new line
    end;

  Text := s;
end;
Please tell me how it works now.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 stefanw

stefanw
  • Members
  • 17 posts

Posted 20 April 2017 - 11:18 AM

Hi,

it is only one step.

The edit control will be correct diplayed but the selection and result is wrong.

 

You can se a screenshot before and after your changes.

 

Check this behaviour with my test-prog, see attached file (Dlephi XE)

 

Thanks.

Stefan

 

Attached Files



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,569 posts
  • Gender:Male

Posted 21 April 2017 - 11:14 PM

Hi,

Unfortunately now we have:

FCheckedStrings.DelimitedText := Text;
We don't have name=value pairs anymore.

I will need to do another approach on this.

If is possible, maybe you can write own routine (Names/Values for this purpose) until I create official one?

I will need to take some thinking about how to do it right and not rush.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 stefanw

stefanw
  • Members
  • 17 posts

Posted 18 August 2017 - 02:49 PM

Hello,

After a time - back to the component NxCheckComboBox6.

Here is my solution in the OnChange-Event.

I need only a delimetered string with names to use it in a db query.

Maybe you can use it to implement as a part of name/value pair funcionality.

procedure TForm1.NxCheckComboBox61Change(Sender: TObject);
var i : Integer;
    CheckNameStr, CheckValueStr : string;
begin
  CheckNameStr := ''; CheckValueStr := '';                                      // Strings leeren
  for i := 0 to Pred(NxCheckComboBox61.Items.Count) do begin                    // Alle Einträge der Combobox
    if NxCheckComboBox61.Checked[i] = True then begin                           // wenn checked dann string füllen
      if CheckNameStr <> EmptyStr then CheckNameStr := CheckNameStr + ',';      // Am Ende ein Komma setzen
      if CheckValueStr <> EmptyStr then CheckValueStr := CheckValueStr + ',';
      CheckNameStr := CheckNameStr + NxCheckComboBox61.Items.Names[i];          // Names schreiben
      CheckValueStr := CheckValueStr + NxCheckComboBox61.Items.ValueFromIndex[i]; // Values schreiben
    end;
  end;
  label2.Caption := CheckNameStr;
  label3.Caption := CheckValueStr;
end;

Thank, Stefan






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users