IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Untypical right click behavior
AIM
post Mar 10 2010, 01:19 PM
Post #1





Group: Honorable Members
Posts: 185
Joined: 26-June 07
Member No.: 1,208



Steps to reproduce:

1. Use a NextGrid with "Multi Select" and "Select Full Row"

2. Select two or more rows

3. Right click a non-selected row --> this will add the right clicked row to the selection instead of un-selecting the old selection first.
Go to the top of the page
 
+Quote Post
Boki (Berg)
post Mar 11 2010, 02:16 AM
Post #2


Boki (Berg)
*****

Group: Forum Admin
Posts: 5,611
Joined: 15-January 05
Member No.: 2



Hello Aim,

I think that I have fix it. If you want, I will send you a updated file.

I will need to test it a little bit more, since this area is a little bit tricky .

Best regards


--------------------
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
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.
Go to the top of the page
 
+Quote Post
AIM
post Mar 11 2010, 11:45 AM
Post #3





Group: Honorable Members
Posts: 185
Joined: 26-June 07
Member No.: 1,208



In the meantime I also found a solution myself, but feel free to send me your solution for testing.

Here's my work around, just something to compare wink.gif

Changes are made in NxCustomGrid.pas

In MouseDown change the code from:

CODE
begin
  inherited;
  Deselect := Button = mbLeft;


to:

CODE
begin
  inherited;
  Deselect := (Button = mbLeft) or (Button = mbRight); // <--- changed


In BodyMouseDown change the code from:

CODE
    { 02/29/08: If multi-select is enabled and user click on already selected cell, we will exit
                to give possibility for Drag & Drop }

    if (goMultiSelect in Options)
      and (goSelectFullRow in Options) then { multi-select? }
    begin
      if RowExist(ARow) and GetSelected(ARow) and Dragging then
      begin
        Deselect := False;
        FCanDeselect := True;
      end;
    end;


to:

CODE
    { 02/29/08: If multi-select is enabled and user click on already selected cell, we will exit
                to give possibility for Drag & Drop }

    if (goMultiSelect in Options)
      and (goSelectFullRow in Options) then { multi-select? }
    begin
      if RowExist(ARow) and GetSelected(ARow) and Dragging then
      begin
        Deselect := False;
        FCanDeselect := True;
      end;
      if RowExist(ARow) and GetSelected(ARow) and (Button = mbRight) then  // <--- new
      begin                                                                // <--- new
        Deselect := False;                                                 // <--- new
        FCanDeselect := True;                                              // <--- new
      end;                                                                 // <--- new
    end;


These changes work perfectly for me.
Go to the top of the page
 
+Quote Post
Boki (Berg)
post Mar 11 2010, 08:17 PM
Post #4


Boki (Berg)
*****

Group: Forum Admin
Posts: 5,611
Joined: 15-January 05
Member No.: 2



Hello Aim,

I have slightly different solution. I was add:

CODE
    if (goMultiSelect in Options)
      and (goSelectFullRow in Options) then { multi-select? }
    begin
      if Button = mbLeft then
      begin
        if RowExist(ARow) and GetSelected(ARow) and Dragging then
        begin
          Deselect := False;
          FCanDeselect := True;
        end;
      end else if Button = mbRight then
      begin
        if not GetSelected(ARow) then
        begin
          Deselect := True;
          FCanDeselect := True;
        end;
      end;
    end;


Best regards. I hope that this work as expected too.

Best regards


--------------------
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
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.
Go to the top of the page
 
+Quote Post
AIM
post Mar 11 2010, 08:50 PM
Post #5





Group: Honorable Members
Posts: 185
Joined: 26-June 07
Member No.: 1,208



QUOTE
Best regards. I hope that this work as expected too.


Yes, thank you. I'm using your solution now...
Go to the top of the page
 
+Quote Post
AIM
post Mar 29 2010, 02:58 PM
Post #6





Group: Honorable Members
Posts: 185
Joined: 26-June 07
Member No.: 1,208



Boki, your solution introduced a bug.

When you right click a selection, everything is fine. If you right click an empty area, you get a crash.

The following change fixes this crash.

From:

CODE
      end else if Button = mbRight then
      begin
        if not GetSelected(ARow) then
        begin
          Deselect := True;
          FCanDeselect := True;
        end;
      end;


To:

CODE
      end else if Button = mbRight then
      begin
        if RowExist(ARow) and not GetSelected(ARow) then // ----- add: RowExist(ARow) and
        begin
          Deselect := True;
          FCanDeselect := True;
        end;
      end;
Go to the top of the page
 
+Quote Post
Boki (Berg)
post Mar 30 2010, 09:40 AM
Post #7


Boki (Berg)
*****

Group: Forum Admin
Posts: 5,611
Joined: 15-January 05
Member No.: 2



Hello Aim,

I am glad that you have spot it. I have include this fix.

Best regards


--------------------
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 10th September 2010 - 10:01 AM