Jump to content


Photo

Problem with TNxComboBoxItem + Cursor key (Bug)


  • Please log in to reply
3 replies to this topic

#1 spongebob

spongebob
  • Members
  • 15 posts

Posted 25 March 2009 - 05:13 PM

If a TNXComboBoxItem is the last Child node in an Inspector, pressing the key "cursor down" modifies the combobox value and the modification is not consistent.
  • The displayed value is changed
  • The value of the Item changes to a different value after activating it again

I attached a small demo - here are my instructions to show the problem
  • Start Inspectorproblem1.exe
  • Press cursor down and keep cursor down pressed
  • Value of the last childitem (combobox) will change to "Comboline5" if you keep cursor down pressed long enough
  • Click on Item 5
  • Click on the last ComboBox Item again (or scroll down to it)
  • ComboBox Value changes to "Comboline1" magically ohmy.gif
  • Finally : scroll up to the first Combobox Item. This combobox does not change the value with the cursor key !

I think this behaviour is not desirable. Why does cursor down change the value of the combobox if it is the last childItem ? I do not want the cursor keys to change combobox Values at all.
(My users can easily screw up the program configuration by pressing cursor down in the Inspector if it behaves this way !)

Any ideas anyone ? How do you prevent this from happening ?

Thanks for your help !!!

Attached Files



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 26 March 2009 - 01:29 AM

Hello Spongebob,

I will test it and fix it. I hope that I will fix it tomorow.

Thank you
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 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 27 March 2009 - 01:19 AM

Hello SpongeBob,

Try with this change:

1. Open NxEdit.pas
2. Find procedure TNxComboBox.KeyDown and add this line:

CODE
procedure TNxComboBox.KeyDown(var Key: Word; Shift: TShiftState);
begin
  inherited;
  if FDroppedDown then
  begin
    with FPopupControl as TNxPopupList do
      case Key of
        VK_UP: if (HoverIndex > 0) and not(ssAlt in Shift) then Self.ItemIndex := HoverIndex - 1;
        VK_DOWN: if (HoverIndex < Pred(FItems.Count)) and not(ssAlt in Shift) then Self.ItemIndex := HoverIndex + 1;
      end;
  end else
  begin
    if InplaceEditor then Exit; // <----------------- New Line
    case Key of
      VK_UP: if (ItemIndex > 0) and not(ssAlt in Shift) then ItemIndex := ItemIndex - 1;
      VK_DOWN: if (ItemIndex < Pred(FItems.Count)) and not(ssAlt in Shift) then ItemIndex := ItemIndex + 1;
    end;
  end;
end;


Please tell me if this solve your problem.

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.

#4 spongebob

spongebob
  • Members
  • 15 posts

Posted 27 March 2009 - 12:19 PM

QUOTE (Boki (Berg) @ Mar 27 2009, 01:19 AM) <{POST_SNAPBACK}>
...

Please tell me if this solve your problem.

Best regards


This works nicely - thanks a lot for your help !
I tested the combobox in tNextInspector and tNextGrid and everything works as expected - please include this change in future versions.

Have a nice day !






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users