Page 2 of 4

Re: GRID : problem with delete and refresh

Posted: Fri Apr 08, 2016 4:45 pm
by TopsMarc
Hi Andyglezl,
When I read the other post, it seems that I am not the only one having troubles with the grid.
I copied the GridOnSave() from the other post, but I get compilation errors, undefined reference RegEnRed.
I did some experimenting with the BROWSE control, and every test worked perfectly. But every experiment I do with the GRID control, ends in disaster. I read that the BROWSE control is obsolete and superseded by the GRID control. As I see it, the BROWSE is irreplaceable and the GRID had serious defects when deleting, saving and refreshing records doesn't work. Or maybe I do not have enough experience yet to understand how a grid works. GRID examples are always welcome.
Kind regards, Marc

Re: GRID : problem with delete and refresh

Posted: Sat Apr 09, 2016 3:59 am
by andyglezl
TopsMarc wrote:Hi Andyglezl,
...
I copied the GridOnSave() from the other post, but I get compilation errors, undefined reference RegEnRed.
...
Kind regards, Marc
Dentro de este mismo post, está el ejemplo donde viene la función RegEnRED().
------------------------------------------------------------------------------------------------
Within this post, it is the example where the RegEnRED() function is.

Tu lo puedes descargar de aqui...
-------------------------------------------------> download/file.php?id=6656
You can download it from here ...

Re: GRID : problem with delete and refresh

Posted: Thu Apr 14, 2016 1:21 pm
by TopsMarc
Hi everybody.

A week ago I posted my problem with deleting records and refreshing a grid.
Can someone please make my function KR_Button_Del() work ? I am learning HMG-IDE and I really don’t know why it doesn’t work.
When I delete record BEF, the records EUR and NLG are left in the grid. Fine. When I delete the record EUR, I don’t see the NLG record in the grid, but again the EUR record. Even when I hit the refresh button, I don’t see the NLG record, but the EUR record. What am I doing wrong ? In VM.ZIP included the latest version of the small and simple program and the database.

FUNCTION KR_Button_Del()
VM->(DBGoto( Win_KR.KR_Grid_KR.RecNo ))
VM->(DBDelete())
VM->(DBSkip())
IF VM->(EOF())
VM->(DBGoBottom())
ENDIF
Win_KR.KR_Grid_KR.RecNo := VM->(recno())
Win_KR.KR_Grid_KR.Refresh
Win_KR.KR_Grid_KR.Setfocus
RETURN

FUNCTION KR_Button_Refresh()
Win_KR.KR_Grid_KR.Refresh
Win_KR.KR_Grid_KR.Setfocus
RETURN

Kind regards, Marc

Re: GRID : problem with delete and refresh

Posted: Thu Apr 14, 2016 6:25 pm
by serge_girard
Marc, This seems to work fine?

Serge

Re: GRID : problem with delete and refresh

Posted: Thu Apr 14, 2016 8:24 pm
by TopsMarc
Hi Serge,
I don't understand how it seems to work fine for you and not for me. I recorded what I see (see the video in attachment). Do you see something else on your computer when you run this program ? When I delete the EUR-record, I don't see the NLG-record, but again the EUR-record. And the refresh-button doesn't help. I did it twice to demonstrate the delete and refresh in a grid don't work here. Do you see something else ?
Best regards, Marc

Re: GRID : problem with delete and refresh

Posted: Fri Apr 15, 2016 1:22 pm
by serge_girard
Marc,

Try this:

( pack + go top )

Code: Select all

FUNCTION KR_Button_Del()
   VM->(DBGoto( Win_KR.KR_Grid_KR.RecNo ))
   VM->(DBDelete())
   VM->(DBSkip())
   IF VM->(EOF())
      VM->(DBGoBottom())
   ENDIF
   pack
   go top
   Win_KR.KR_Grid_KR.RecNo := VM->(recno())
   Win_KR.KR_Grid_KR.Refresh
   Win_KR.KR_Grid_KR.Setfocus
RETURN
Probably the index/recno is messed up causing strange behaviour. The above should work well.
By the see PM.

Serge

Re: GRID : problem with delete and refresh

Posted: Fri Apr 15, 2016 4:10 pm
by TopsMarc
Hi Serge,

Thank you for your suggestion to do a 'pack' after deleting a record.

Maybe it is possible that my index becomes corrupt. In that case I am curious why it becomes corrupt and how to prevent corruption.
My file has only 3 records and 'pack' is fast. But is it recommended on large files that have some indexes on it ? Maybe it takes a few seconds then ? Therefore it seems not recommended to do a pack every time after deleting one record.

I also hope that the designers HMG-IDE read this post in case the problem with the delete and refresh is in the grid itself.
Please look at the video in file 'VM Recorded.zip' I posted earlier.

Kind regards, Marc

Re: GRID : problem with delete and refresh

Posted: Sat Apr 16, 2016 12:34 pm
by TopsMarc
Hi everybody,

Please play my new movie 'VM Movie.zip'

I modified my program. On the left screen side I have a grid control, on the right a browse control. Both use the same workarea.
When I delete records in the grid control, it is not okay.
When I delete records in the browse control, everything is okay.
Therefore I don't think my index is corrupted.

Play the video and see the difference in the grid and the browse control. Can someone give a logical explanation for this ?

Kind regards, Marc

Re: GRID : problem with delete and refresh

Posted: Sat Apr 16, 2016 1:25 pm
by apais
Mark:
That's an almost philosofical question.
Developpers here in HMG are trying to deprecate browse in favour of grid.
The problem is that grids where made by MS to manage static detached recordsets and browse made to work on living data as habour allways have done.
Obviously there's some kind of bug in the navigation logic of the grids that doesn't allow them to fully replicate browse behabiour.

Re: GRID : problem with delete and refresh

Posted: Sat Apr 16, 2016 3:41 pm
by TopsMarc
Dear mr Apais,

Thank you for your reply.
Does this mean that the HMG development team will handle my grid issue and probably in the future will fix this navigation error ? I would like that very much. Or can't anything be done because grids were made by MS ?

Kind regards, Marc