Results 1 to 6 of 6

Thread: Moving from column to column in DBGrid

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Dublin, IRE
    Posts
    111
    [Apologies for the double post, but this is a matter of some urgency]

    I just created my first DBGrid (yaaah!) but I'm having trouble moving from column to column. I tried TAB, but that just moves to the next control, and <RET> just activates the default button.

    So, without using the mouse, how do I get to the next column? And back?

  2. #2
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768

    Set Focus

    This is just a suggestion. Can't you catch the key event for the tab key and then just set the grid to the next column.Keep track of where the column was at last. In a var. That is the only idea i can think of. I will try to find out for you.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Dublin, IRE
    Posts
    111
    jjortiz, in a fit of perceived brilliance last night, I tried that. I have the following in DBGrid KeyDown event

    Code:
    If KeyCode = 9 Then
           DBGrid1.Col = DBGrid1.Col + 1
    End If
    It gets there, and increments the .Col property, but it still uses the default event of pressing the Tab Key, which is "go to the next control". Is there any way of telling it not to do this? In VFP, you can use NODEFAULT to override certain system functions.

  4. #4
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    Code:
    If KeyCode = 9 Then
           DBGrid1.Col = DBGrid1.Col + 1
    End If
    Try something like this:
    Code:
    If KeyCode = 9 Then
          KeyCode = 0 
          DBGrid1.Col = DBGrid1.Col + 1
    End If

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Dublin, IRE
    Posts
    111
    Worked like a charm. You da man :cool

    Thanks.

  6. #6
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    Yeah when you set the keycode to something else it performs that action like keycode = 0 then it cancels it. There is no keycode 0. You are welcome. And thanks for that you are the man. Makes me feel that i have chosen the right path.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width