Jump to content


Photo

Display of ComboBox with dynamic contents


  • Please log in to reply
3 replies to this topic

#1 PCBleu

PCBleu
  • Members
  • 33 posts

Posted 29 June 2015 - 07:02 PM

Hey

 

I have a problem when displaying dynamic contents with the TNxComboBox component...

 

in the delphi7 program joined, Attached File  TestNxComboBox.zip   8.38KB   1 downloads

I build an application with 30 choices in a combobox and preselect the 7th choice

 

by hitting the "3 elts" button, I clear the combobox and I add only 3 choices

:rolleyes: but when I try to present the three different choices, I can view only one element, and the first two choices are not visible

 

Can you tell me what I need to do to have a correct dynamic display

 

Thanks in Advance

 

:mellow:

 

 



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 01 July 2015 - 04:37 PM

Hi,

 

Try to update this method inside NxPopupControl.pas

procedure TNxPopupList.SetItemIndex(const Value: Integer);
var
  Delta: Integer;
begin
  FItemIndex := Value;
 
// <--- new code ---->
  if Assigned(Items) then
    if FItemIndex >= Pred(Items.Count)
      then FItemIndex := Pred(Items.Count);
// <---- end of new code --->
 
  if FItemIndex >= VertScrollBar.Position + GetVisibleCount then
  begin
    Delta := FItemIndex - (VertScrollBar.Position + GetVisibleCount - 1);
    VertScrollBar.MoveBy(Delta);
  end
  else if FItemIndex < VertScrollBar.Position then
  begin
    Delta := FItemIndex - VertScrollBar.Position;
    VertScrollBar.MoveBy(Delta);
  end;
  SetHoverIndex(FItemIndex);
end;

Please tell me how it works now.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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 PCBleu

PCBleu
  • Members
  • 33 posts

Posted 02 July 2015 - 11:29 AM

Hello

 

Thanks for your answer

 

but I did not find NxControlPopup.pas in NextGrid for Delphi 7...

 

in fact I made this change in the source code I sent 

and it works as your change - but in fact I force itemIndex with 0 value

procedure TForm1.SetCombBox(iiStep:integer);
var ii : integer;
begin

// code added
  if NxComboBox1.Items.Count > 0 then NxComboBox1.ItemIndex := 0;
// end of code added

  NxComboBox1.Items.Clear;
  ii := 1;
  while (ii <= 30) do
   begin
    NxComboBox1.Items.Add('Choice ' + inttostr(ii));
    ii := ii + iiStep;
   end;
end;

and that is ok



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 02 July 2015 - 06:58 PM

Aha, didn't know that you use version without source.

 

Anyway it will be included in next version too.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users