Results 1 to 3 of 3

Thread: cDbCjGrid focus

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    SW Connecticut/NY area

    Default cDbCjGrid focus

    I’m still working with converting all dbGrids in my inherited 40-year old application and I’m on the last one. All of the others converted fairly easily but this one is the 800 pound gorilla of the grids with over 4K lines of code in the grid itself. I’ve got it mostly working but the current bug is being difficult.

    This grid is on tab 3 of a dbTabDialogView. The users work from tab 1 where the highest level of the set of tables is worked with. Then they go to tab 2 for the next down level and then to tab 3 for the lowest level. Think of it as tab 1 = customer, tab 2 = orders, tab 3 = shipments.

    Tab 3 consists of the usual collection of buttons, forms, textboxes and the grid. All controls other than the grid are shadowed when the user gets to tab 3 so the grid should take the focus but it doesn’t seem to and that’s my problem. We are in a “create” mode at this point where the user will create new records and in the old grid version some of the columns in the grid are prepopulated with data in the first record and the user lands in the first enterable column, ready to make the necessary entries.

    But what happens is that the grid does take the focus momentarily, and that column is available, but then it loses the focus. Walking through it with the debugger, you can see what happens. When you first get to the grid from the switching it looks like this:

    Click image for larger version. 

Name:	gridNoFocus.jpg 
Views:	23 
Size:	6.5 KB 
ID:	14693

    Then takes the focus Click image for larger version. 

Name:	gridWithFocus.jpg 
Views:	18 
Size:	7.4 KB 
ID:	14694

    And then loses it again. Click image for larger version. 

Name:	gridNoFocus.jpg 
Views:	23 
Size:	6.5 KB 
ID:	14693

    If I manually click in that field, it takes the focus as expected and I see all the normal default data, go figure.

    I’ve tracked down what seems to cause the loss of focus which is populating the DDs on that tab. The following code is called in the switch_to_tab and is used to populate the 3rd tab DDs. If I comment this out then the grid retains it's focus.

              Procedure DoFindOrderAndContract Handle hContractsDD Handle hOrdersDD Handle hShipDD
                 Send RebuildAllConstraints of hShipDD
                 If (not(HasRecord(hContractsDD))) ;
                     Send Request_Superfind of hContractsDD EQ File_Field Wwitm.Con_item
                 If (not(HasRecord(hOrdersDD))) ;
                     Send Request_Superfind of hOrdersDD EQ File_Field Wwso.So_num
    So the questions are why? And how can I get the grid to take the focus? I've tried sending activate to it after the above code, I've also tried sending Move_To_First_Row, MoveToColumnObject and MoveToFirstEnterableColumn but none of them do the trick.
    Last edited by Bob Worsley; 18-Jun-2021 at 06:34 PM. Reason: one more thought...
    Bob Worsley
    rlworsley at

    Do or do not. There is no try. — Yoda

Posting Permissions

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