Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Grid Cell Display Problem

  1. #1

    Grid Cell Display Problem

    Hi Folks,

    I have an interesting situation.

    The solution is probably very simple.

    Suggestions are welcome and requested.

    The attachment explains all. (A picture is worth ...)

    Thanks in advance,

    Peter H.
    Attached Files Attached Files
    Thought for the day (in a broad Australian accent):<br />First of all yer gungadin. Afterwards yer gungadout.

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Ciao Petr.

    I think it is a bug of the grid control. I have to check it and see how I can evoid it.

    As a work around I can suggest (but not tested) to:
    fill your grid
    show the grid
    move (by code) active cell from cell 1:1 to another one
    move (by code) active cell back to 1:1

    Later I will move this post to support area http://www.thinbasic.com/community/project.php

    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    Hi Eros,

    Thanks for your help.

    I'll try what you have suggested and see how it goes.

    Regards,

    Peter H.
    Thought for the day (in a broad Australian accent):<br />First of all yer gungadin. Afterwards yer gungadout.

  4. #4
    Hi Eros,

    Maybe my domestic blindness is taking over again, but I could find no obvious instruction for moving focus from one cell to another in a grid programmatically, in either the good example or the documentation.

    I tried a couple of other things, but to no avail.

        TempString2 = MLGRID_Get(CurrentGridHandle, 1, 2)
        TempString = MLGRID_Get(CurrentGridHandle, 1, 1)
        n = MLGRID_Put(CurrentGridHandle, 1, 2, TempString)
        TempString = MLGRID_Get(CurrentGridHandle, 1, 2)
        n = MLGRID_Put(CurrentGridHandle, 1, 1, TempString)
        n = MLGRID_Put(CurrentGridHandle, 1, 2, TempString2)
    
        TempString = MLGRID_Get(CurrentGridHandle, 1, 2)        ' These two lines position away from col 1
        n = MLGRID_Put(CurrentGridHandle, 1, 2, TempString)
        Console_WriteLine "FixFirstGridElement: GridNo = " + CurrentGridHandle + "  TempString = " + TempString
        TempString = MLGRID_Get(CurrentGridHandle, 1, 1)        ' These two lines position away from col 1
        n = MLGRID_Put(CurrentGridHandle, 1, 1, TempString)
        Console_WriteLine "FixFirstGridElement: GridNo = " + CurrentGridHandle + "  TempString = " + TempString
    
    What did I miss?

    Thanks,

    Peter H.

    (Also, I don't seem to be able to change my profile any more. I need a hint.)
    Thought for the day (in a broad Australian accent):<br />First of all yer gungadin. Afterwards yer gungadout.

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Have you checked MLGrid_SetSelected:
    http://www.thinbasic.com/public/prod...etselected.htm

    Call it after you have filled and showed your grid.
    Move (for example) selected cell from (for example) 1:1 to 1:2 and back to 1:1



    Regarding your profile, there is one more questions you have to reply: http://www.thinbasic.com/community/s...ent-high-level
    Fill field "Real name" with something you like.
    It was done to avoid bots to register fake user in this forum.

    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    Hi Eros,

    Thanks once again for your help. (Both questions.)

    As you will see in the attachment, I execute the special logic after I have filled the grid.

    The grid is filled from a long string of data coming from the database. The string is prompted for, received, and the decoding function invoked (grid cells filled) within:
      CallBack Function cbDialogScreen()
    
        Select Case Callback_Message
    
          Case %WM_INITDIALOG
    
    The end of the decoding function (which checks for the presence of a grid and the presence of more than one cell's worth of data) looks like this:
        Loop While (Len(Buffer) > 0) And Found = 1
    
    ' input string decoding completed. now return to calling function.
    
        If InitialGridFieldFound > 0 Then
          If InitialGridFieldFound > 1 Then
            FixFirstGridElement()
          End If
          InitialGridFieldFound = 0
        End If
          
      End Function
    
    (This is a general function used to decode strings from the database on the fly as well, hence the test for, and the initialization of, the InitialGridFieldFound variable.)

    I also tried moving that logic into a Case %WM_INITDIALOG section within the cbGrid dialog. That did not work either.

    Please note: I modified the excellent grid control example to place a value in cell 1,1 before the random cell filling loop execution. The problem did not occur. Therefore, the problem may be something to do with my grid setup rather than being a problem with thinBasic.

    I will play around with my grid setup to see if that helps alleviate the situation.

    Thanks once again for your help,

    Peter H.
    Thought for the day (in a broad Australian accent):<br />First of all yer gungadin. Afterwards yer gungadout.

  7. #7
    Hi Eros,

    Oops!

    I missed the link to MLGrid_SetSelected before.

    I have now tried:
      Function FixFirstGridElement()
        
    '    TempString = MLGRID_Get(CurrentGridHandle, 1, 2)        ' These two lines position away from col 1
    '    n = MLGRID_Put(CurrentGridHandle, 1, 2, TempString)
    'Console_WriteLine "FixFirstGridElement: GridNo = " + CurrentGridHandle + "  TempString = " + TempString
    '    TempString = MLGRID_Get(CurrentGridHandle, 1, 1)        ' These two lines position away from col 1
    '    n = MLGRID_Put(CurrentGridHandle, 1, 1, TempString)
    'Console_WriteLine "FixFirstGridElement: GridNo = " + CurrentGridHandle + "  TempString = " + TempString  
    '
    '    TempString2 = MLGRID_Get(CurrentGridHandle, 1, 2)
    '    TempString = MLGRID_Get(CurrentGridHandle, 1, 1)
    '    n = MLGRID_Put(CurrentGridHandle, 1, 2, TempString)
    '    TempString = MLGRID_Get(CurrentGridHandle, 1, 2)
    '    n = MLGRID_Put(CurrentGridHandle, 1, 1, TempString)
    '    n = MLGRID_Put(CurrentGridHandle, 1, 2, TempString2)
    
    n = MLGRID_SetSelected(hGrid, 1, 2)
    Console_WriteLine "n = MLGRID_SetSelected(hGrid, 1, 2) executed "
    'n = MLGRID_SetSelected(hGrid, 1, 1)
    'Console_WriteLine "n = MLGRID_SetSelected(hGrid, 1, 1) executed "
    
        InitialGridFieldFound = 0
        
      End Function
    
    The pointing to 1,2 then back to 1,1 made no difference, so I suppressed the pointing back to 1,1 to see what would happen using just the 1,2. Nothing did. So once again, I assume I am doing something wrong somewhere.

    Another note: I placed MLGRID_SetSelected(hGrid, 1, 2) into the excellent grid example after the random cell filling loop, to see what would happen. It works well. However, for some reason, row 3 becomes the first row visible in the grid. I have to move the slide bar up to see rows 1 and 2.

    I will scratch around to uncover the source of the foolishness I am perpetrating.

    Once again, thanks for your help.

    Regards,

    Peter H.
    Thought for the day (in a broad Australian accent):<br />First of all yer gungadin. Afterwards yer gungadout.

  8. #8
    Hi Eros,

    Aha!

    If the thinBasic window loses focus and then regains it, cell 1,1 shows the value it should, and cell 1,2 has the focus.

    I found that out by accident, because I had to concentrate on other things for a while.

    The correct display when window focus is regained, is consistent, as is the lack of correct display before focus is lost and regained.

    That probably tells me something, but I'm not sure what yet.

    I will keep experimenting in the light of this new knowledge.

    Regards,

    Peter H.
    Thought for the day (in a broad Australian accent):<br />First of all yer gungadin. Afterwards yer gungadout.

  9. #9
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Petr,

    I will check this night.
    Possibly I will try to definitely fix the problem and release a new thinBasic_UI.DLL
    I think I already know how to do it because that grid is the same used in thinDebug

    Sorry for the delay
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    I'm checking the problem.

    In the meantime, have your trued to put %TRUE in refresh parameter of mlgrid_put function? Something like:

    mlgrid_put(hgrid, 1, 1, "Cell data in 1:1", %TRUE)
    
    Setting %TRUE will force to refresh visualized data after setting the cell.

    Let me know
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Page 1 of 2 12 LastLast

Similar Threads

  1. tron grid?
    By largo_winch in forum TBGL General
    Replies: 12
    Last Post: 05-06-2011, 14:11
  2. Another Grid Question
    By gungadout in forum thinBasic General
    Replies: 2
    Last Post: 16-12-2010, 13:08
  3. Two Grid Questions
    By gungadout in forum thinBasic General
    Replies: 2
    Last Post: 16-12-2010, 12:43

Members who have read this thread: 0

There are no members to list at the moment.

Tags for this Thread

Posting Permissions

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