Jump to content


Photo

Focus not set on the selected item


  • Please log in to reply
5 replies to this topic

#1 Heleena

Heleena
  • Members
  • 3 posts

Posted 11 July 2007 - 07:25 AM

Hi Boki,


I have the following structure to be displayed in a TNxInspector control

There are three main nodes, and the sub items under these nodes are of the given structure. There may be more than
25 such items. All items are included at run time.

Main category 1
- Item 1 TNxColorItem
- Item 2 TNxColorItem
- Item 3
-- Attribute 1 TNxComboboxItem
-- Attribute 2 TNxComboboxItem
-- Attribute 3 TNxComboboxItem
---
---
---
Main category 2
- Item 1 TNxColorItem
- Item 2 TNxColorItem
- Item 3
-- Attribute 1 TNxComboboxItem
-- Attribute 2 TNxComboboxItem
-- Attribute 3 TNxComboboxItem
---
---
---
Main category 3
- Item 1 TNxColorItem
- Item 2 TNxColorItem
- Item 3
-- Attribute 1 TNxComboboxItem
-- Attribute 2 TNxComboboxItem
-- Attribute 3 TNxComboboxItem
---
---
---

My problem here is,

- If all the nodes are expanded, I can select an item easily by clicking on to it.
- If I collapse a node, for e.g., Main Category 1, and try to select an item under Main Category 2,
focus is not on the selected item, but it moves somewhere else. [In other words, couldn't select a specific item by clicking on to it]. Can you please look into it?
- Also, is there a way to disable mouse wheel selection of combobox items?


Regards,
Heleena.

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 11 July 2007 - 09:21 AM

Hello Heleena,

For me all work fine, maybe somehow you are using old version where this bug have appear. If you can send me demo (compiled and source), I will compare them and see if problem is in old version.

This will help to find problem shortly. At first look, maybe you are using old version.

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.

#3 Heleena

Heleena
  • Members
  • 3 posts

Posted 11 July 2007 - 10:28 AM

Here is a demo to reproduce the issue

Attached Files



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 11 July 2007 - 03:37 PM

Hello Heleena,

I have spot it. I will fix it now. Thank you.

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.

#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 11 July 2007 - 04:35 PM

Hello Heleena,

Please open NxInspector.pas file.

Find method ScrollTo. Replace it completely with next code:

CODE
procedure TNxCustomInspector.ScrollTo(const Index: Integer);
var
  Delta, ACount, ATop: Integer;
begin
  ATop := Items.Node[Index].Top;
  if InRange(ATop, 0, ClientHeight) then
  begin
    if Items.Item[Index].Top + RowHeight + GetGridSpace > ClientHeight
      then VertScrollBar.Next;
    Exit;
  end;

  ACount := GetClientCount;
  if Index >= VertScrollBar.Position + ACount then
  begin
    Delta := Index - (VertScrollBar.Position + ACount - 1);
    VertScrollBar.MoveBy(Delta);
  end else if Index < VertScrollBar.Position then
  begin
    Delta := Index - VertScrollBar.Position;
    VertScrollBar.MoveBy(Delta);
  end;
  if Items.Item[Index].Top + RowHeight + GetGridSpace > ClientHeight
    then VertScrollBar.Next;
end;


For now, it works fine, but I will test it a little bit more.

I hope that in your case it will work.

Thank you for your sample project.

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.

#6 Heleena

Heleena
  • Members
  • 3 posts

Posted 12 July 2007 - 11:22 AM

It works great in my case. Thank you.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users