Jump to content


Photo

Set TNxComboBoxItem value


  • Please log in to reply
6 replies to this topic

#1 array81

array81

    Senior Member

  • Members
  • PipPip
  • 290 posts
  • Gender:Male

Posted 21 August 2012 - 11:51 PM

Is there a way to change the TNxComboBoxItem ItemIndex property by code.

I just have try this:
TNxComboBoxItem(myItem).Editor.AsInteger := 1;
myItem.ItemIndex := 1;

but the ComboBox didn't change...

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 01 September 2012 - 07:10 PM

Hi,

Can you please send me small demo project to I fix it and send it back to you.

There may be several situations.
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 array81

array81

    Senior Member

  • Members
  • PipPip
  • 290 posts
  • Gender:Male

Posted 01 September 2012 - 11:58 PM

Hi,

you can find a demo here: https://dl.dropbox.c...900180/demo.zip

PROBLEM 1
1. run the demo;
2. click on "insItem1.ItemIndex := 1;" button -> you can see the "insItem1" change item;
3. click on "insItem2.ItemIndex := 1;" button (insItem2 is not visible);
4. click on "insItem2.Visible := True;" button (insItem2 is not visible); -> the item is NOT changed!

PROBLEM 2
1. run the demo;
2. select "Item 1";
3. click on "insItem1.ItemIndex := 1;" button -> the "Item 1" don't change item on ComboBox;

thanks

#4 array81

array81

    Senior Member

  • Members
  • PipPip
  • 290 posts
  • Gender:Male

Posted 07 September 2012 - 06:50 PM

Any news?

#5 array81

array81

    Senior Member

  • Members
  • PipPip
  • 290 posts
  • Gender:Male

Posted 03 October 2012 - 01:35 PM

I have post this problem 22 august and add a demo 2 september.
Can I have a reply?
I cannot finish my application...

I need change ItemIndex by code for visible and not visible item.

Thanks

#6 Unx

Unx
  • Members
  • 37 posts

Posted 04 October 2012 - 02:05 AM

@array81 in your demo app is a mistake

procedure TForm1.NxButton2Click(Sender: TObject);
begin
insItem1.ItemIndex := 1;
end;
procedure TForm1.NxButton4Click(Sender: TObject);
begin
insItem1.ItemIndex := 1;
end;


I know only a problem when you want change the selected item, then it is not correct displayed,
but here is a workaround....

before you change a property per code

NextInspector1.EndEditing();
NxComboBoxItem1.ItemIndex := 1;

#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 October 2012 - 09:37 AM

Hi,

Please sorry for delay, again.

Yes, there is a type error in demo. All worked fine.

2) If Item is in edit mode, then you need to act to Editor itself, not to Item.

Best regards
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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users