Problems with Grid in Edit mode

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Problems with Grid in Edit mode

Post by sudip »

Hello All,

I am not sure whether following is a bug or feature of grid. So, I am posting it in General Help section. :)

When Cellnavigation is .t.:
If the grid has 4 columns and colmun when property is {{||.t.},{||.t.},{||.f.},{||.t.}, when I am in 2nd col in edit mode, pressing enter key doesn't go to 4th column.

When Cellnavigation is .f.:
When I go to edit mode by pressing enter key, double clicking on previous column of the same row doesn't terminate the edit mode, but the focus goes to next column. But this problem doesn't occur when I go to edit mode by double clicking mouse.

Please correct me if I am wrong :)

Thanks in advance.

With best regards.

Sudip
With best regards,
Sudip
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Problems with Grid in Edit mode

Post by Roberto Lopez »

sudip wrote:Hello All,

I am not sure whether following is a bug or feature of grid. So, I am posting it in General Help section. :)

When Cellnavigation is .t.:
If the grid has 4 columns and colmun when property is {{||.t.},{||.t.},{||.f.},{||.t.}, when I am in 2nd col in edit mode, pressing enter key doesn't go to 4th column.
This is correct.

You are attempting to edit the second column and that column is not editable, so, nothing should happen.

Automatically force edit a column that the user had not requested, could be confusing and drive to errors.
sudip wrote: When Cellnavigation is .f.:
When I go to edit mode by pressing enter key, double clicking on previous column of the same row doesn't terminate the edit mode, but the focus goes to next column. But this problem doesn't occur when I go to edit mode by double clicking mouse.
I'll added and tested this feature with cellnavigation in mind and I've not tested in other situations.

It could be a bug.

I'll check it ASAP.

Thanks for the report.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Problems with Grid in Edit mode

Post by Roberto Lopez »

sudip wrote: When Cellnavigation is .f.:
When I go to edit mode by pressing enter key, double clicking on previous column of the same row doesn't terminate the edit mode, but the focus goes to next column. But this problem doesn't occur when I go to edit mode by double clicking mouse.
I've was not able to reproduce the problem.

It is working fine here.

Please, post a small sample showing the problem.

TIA.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: Problems with Grid in Edit mode

Post by Czarny_Pijar »

Roberto Lopez wrote:I've was not able to reproduce the problem.

It is working fine here.

Please, post a small sample showing the problem.

TIA.
To reproduce this error, the usual code snippet might be not enough.
To show the mouse / keyboard events in the working program, I can reccomend the freeware http://www.debugmode.com/wink/
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Problems with Grid in Edit mode

Post by sudip »

Roberto Lopez wrote:...
I've was not able to reproduce the problem.

It is working fine here.

Please, post a small sample showing the problem.
Hello Roberto,

Thank you very much for checking these points. I saw these problems in numeric textboxes within a grid. For the first problem I mentioned, I completely agree with you, but I might have tried to explain a different thing. I shall explain both points along with a small sample :)

With best regards.

Sudip
With best regards,
Sudip
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Problems with Grid in Edit mode

Post by sudip »

Hello Roberto,

Sorry for the delay. I created a small sample to explain what I want to say.

This sample has 2 grids. 1st grid is Cellnavigated and 2nd grid is not Cellnavigated. 3rd col for each grid is deactivated.
gridtest002.jpg
gridtest002.jpg (50.51 KiB) Viewed 3434 times
For 1st grid, when I go to 2nd col in edit mode, pressing Enter goes to 3rd col, but IMHO, it should go to 4th col, which actually works for 2nd grid (when cellnavigation is .f.).

For 2nd grid. I pressed Enter to go to edit mode. First I was in the 1st col. Then I pressed Enter to go to 2nd col. Then I clicked on the 1st col in the same row. But, the cursor went to 4th col. May be I am wrong, but IMHO it should come out of edit mode. But, when I went to edit mode by double clicking on 2nd col, doing the same thing, takes me out of edit mode, which is, IMHO, fine.

Code: Select all

#include <hmg.ch>

Function Main

   local i, aControls := {{'TEXTBOX', 'NUMERIC', '9999999.99'}, {'TEXTBOX', 'NUMERIC', '9999999.99'}, ;
      {'TEXTBOX', 'NUMERIC', '9999999.99'}, {'TEXTBOX', 'NUMERIC', '9999999.99'}}, ;
      aColwhen := {{|| .T.}, {|| .T.}, {|| .F.}, {|| .T.}}
   
   DEFINE WINDOW main AT 144 , 336 WIDTH 550 HEIGHT 474 TITLE "Grid Test" main

      DEFINE GRID Grid_1
         ROW    30
         COL    30
         WIDTH  480
         HEIGHT 170
         WIDTHS { 100, 100, 100, 100 }
         HEADERS {'col 1', 'col 2', 'col 3', 'col 4'}
         COLUMNWHEN aColwhen
         ALLOWEDIT .T.
         COLUMNCONTROLS aControls
         CELLNAVIGATION .T.
      END GRID
      
      DEFINE GRID Grid_2
         ROW    220
         COL    30
         WIDTH  480
         HEIGHT 180
         WIDTHS { 100, 100, 100, 100 }
         HEADERS {'col 1', 'col 2', 'col 3', 'col 4'}
         COLUMNWHEN aColwhen
         ALLOWEDIT .T.
         COLUMNCONTROLS aControls
         CELLNAVIGATION .F.
      END GRID
   
   END WINDOW

   FOR i := 1 to 10
      main.grid_1.additem({i*100, i*200, i*300, i*400})
      main.grid_2.additem({i*150, i*250, i*350, i*450})
   NEXT

   Main.Center
   Main.Activate

Return
Please correct me if I have any wrong conception. :)

Thanks in advance.

With best regards.

Sudip
With best regards,
Sudip
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Problems with Grid in Edit mode

Post by Roberto Lopez »

sudip wrote:Hello Roberto,

Sorry for the delay. I created a small sample to explain what I want to say.
<...>
Thanks for the report.

I¡ll check it ASAP.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Problems with Grid in Edit mode

Post by Roberto Lopez »

sudip wrote:Hello Roberto,

Sorry for the delay. I created a small sample to explain what I want to say.
<...>
I've tested and understood you point.

When you are in non-cellnavigated grid and start editing, you are editing an entire row, so, this is the reason because the focus jumps automatically to the next available cell to edit and edition starts immediately. This is reasonable since individual cells are not navigable.

In cellnavigation mode you are not necessarily editing an entire row. You select a cell to edit and press <enter> to start editing.

Besides that the non-editable cells are 'navigable', so, skipping cells avoiding navigation because they are not editable, could be a bad thing in certain situations.

By the other hand, I understand that is more comfortable and maybe more desirable the behavior that you propose.

I'll think on that before take a final decision...
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Problems with Grid in Edit mode

Post by sudip »

Thanks a lot :)
With best regards,
Sudip
Post Reply