View Full Version : Grid Cell Display Problem
gungadout
07-01-2011, 02:41
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.
ErosOlmi
07-01-2011, 11:42
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
gungadout
10-01-2011, 05:44
Hi Eros,
Thanks for your help.
I'll try what you have suggested and see how it goes.
Regards,
Peter H.
gungadout
11-01-2011, 12:04
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.)
ErosOlmi
11-01-2011, 15:35
Have you checked MLGrid_SetSelected:
http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?mlgrid_setselected.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/showthread.php?10988-Anti-spam-that-s-why-current-high-level
Fill field "Real name" with something you like.
It was done to avoid bots to register fake user in this forum.
Eros
gungadout
12-01-2011, 02:26
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.
gungadout
12-01-2011, 03:05
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.
gungadout
12-01-2011, 08:54
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.
ErosOlmi
12-01-2011, 09:49
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
ErosOlmi
12-01-2011, 21:58
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
gungadout
13-01-2011, 14:02
Hi Eros,
Once again, thanks for your continued help.
The following combination successfully displays the value in cell 1,1, but leaves focus on cell 1,2 until the thinBasic window loses focus and regains it.
When the thinBasic window regains focus, the grid focus has returned to cell 1,1.
As you can see in the example, multiple instructions to place focus onto cell 1,1 make no difference.
n = MLGRID_SetSelected(hGrid, 1, 2)
TempString = MLGRID_Get(CurrentGridHandle, 1, 1)
n = MLGRID_Put(CurrentGridHandle, 1, 1, TempString, %TRUE)
n = MLGRID_SetSelected(hGrid, 1, 1)
n = MLGRID_SetSelected(hGrid, 1, 1)
You have indicated that maybe thinBasic needs some adjustement, so I will move onto other aspects of my thinBasic front end (client), and come back to grid processing later.
FYI, I am also having problems getting the vertical slide bar to appear. It may be my doing, but I'll get back to that later.
Regards,
Peter H.
ErosOlmi
13-01-2011, 17:25
Well, thanks to you for using thinBasic.
I will check focus and scrollbars problems.
In any case with refresh parameter to TRUE you no longer need to move current selected cell.
ErosOlmi
13-01-2011, 17:33
Because I'm not able to replicate your focus and scrollbars problem,
can you please let me know if example in \thinBasic\SampleScripts\UI\MLGrid\MLGRID.tBasic
suffer of the same problems you are facing?
Thanks a lot
Eros
gungadout
21-01-2011, 01:05
Hi Eros,
Sorry for the delay in replying.
I wanted to check a few other things that might have been related to the major problem, to eliminate them from the equation if possible. (One was the vertical slide bar problem that I mentioned in passing in case it was somehow related to the other problem. I have overcome that, so it was not related. The setting focus on a cell seems to be an isolated problem.)
I have tested with the grid example you pointed me to. See the attachment. I cannot replicate the problem I am experiencing, but I have noted some other things.
The attachment has screen dumps which hopefully will make things clear.
BTW, the contents of the caption in my CONTROL ADD MLGRID statement is:
x38, 67.5, 112.5, 60, 82.5, 82.5, 120/s9/t2/b1/r7/c6
The decimals are the result of the column widths being calculated on the fly.
I appreciate your continued help. Thank you.
Regards,
Peter H.
ErosOlmi
23-01-2011, 12:09
I just finished to fix some problems I had on thinAir
I will than check all the points you mentioned in doc.
I will let you know.
Eros
gungadout
17-06-2011, 03:03
Hi Eros,
Update:
The company I work for was looking for ways to convert a system written in a character-based 4GL, into a Windows-style environment.
I was hoping to help put thinBasic on the map by developing an automatic converter. The converter was taking existing 4GL programs and creating back-end database programs which communicated with a general front-end thinBasic program. The thinBasic program was formatting screens dynamically and interacting intelligently with the particular database program that was running at any given time.
I was well advanced in that process (both back-end converter and front-end thinBasic program). The problem was that the 4GL system makes extensive use of grids, and the conversion could progress no further until the current grid display problems in thinBasic were addressed.
Unfortunately, time has run out. The company has decided to take another path. An opportunity lost.
I haven't gone away, however.
I still hope that the grid display problems (as evidenced in the published example) will be corrected, because I plan to use thinBasic for my own purposes. (I will be asking the occasional question in that regard later.) Grids will be of use to me in that context too.
Once again, thank you for your interest in, and help with, all the questions I have asked - not just this one. (Thanks also to you others who have taken time to help me. I have really appreciated, and will continue to appreciate, your efforts and suggestions.)
Regards,
Peter H. (gungadout)
ErosOlmi
17-06-2011, 08:12
Hi Petr,
thanks for letting us know about project progress.
I'm sorry about my development time has not be on time for your company project but at the moment I cannot do more.
What I can say is that I will continue to improve thinBasic in order to be more interesting also for complex projects like your company was.
We use thinBasic for production applications in my company too but mainly for automatic data conversions/synchronizations and not for user interface interaction. On that side thinBasic has still some miles to walk.
Can you please let me know what is the character-based 4GL language?
Thanks again
Eros
gungadout
17-06-2011, 13:02
Hi Eros,
The 4GL is proprietary to the company I work for.
It was specifically designed for use with multi-dimensional, "real world" data bases (as opposed to the single-dimensional, Codd-style databases, which they originally pre-dated).
The major problem with the traditional multi-dimensional databases is that they are character based.
I undertook a similar project some years ago using VB 2003. However, when Microsoft released VB 2005, the structure of the files comprised in VB programs was changed significantly (not just the instructions available). The automatic 2003-to-2005 converter supplied by MS could not handle some of the valid but unusual VB scripting I was using, and fell over. (80-20 rule.) The incompatibility, and expected future incompatibilities as new versions of VB were released, caused that project to be discontinued.
I saw thinBasic as a viable and practical alternative on which to re-launch the project.
I still think thinBasic is great.
I will use it for some personal things now. They won't be rocket science, but once done, I will be free to share them with anyone who might find them worthwhile.
Regards,
Peter H. (gungadout)
ErosOlmi
25-06-2011, 19:26
Dear Peter,
I think I've found and fixed the problem or at least I hope so.
If you are still interested, please check http://www.thinbasic.com/community/showthread.php?11223-thinBasic-Beta-1.8.8.0&p=83814#post83814
and download thinBasic 1.8.8.0
Ciao
Eros
ErosOlmi
26-06-2011, 18:48
Hi again Peter,
just to let you know, I'm working a lot on MLGrid control in order to add more features and options
Maybe it can interest you.
Ciao
Eros