GRID : problem with delete and refresh

Moderator: Rathinagiri

User avatar
TopsMarc
Posts: 80
Joined: Wed Apr 06, 2016 5:57 am
Location: Belgium (Flanders)

Re: GRID : problem with delete and refresh

Post 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
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: GRID : problem with delete and refresh

Post 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 ...
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
TopsMarc
Posts: 80
Joined: Wed Apr 06, 2016 5:57 am
Location: Belgium (Flanders)

Re: GRID : problem with delete and refresh

Post 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
Attachments
VM.zip
(3.5 KiB) Downloaded 218 times
User avatar
serge_girard
Posts: 3178
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: GRID : problem with delete and refresh

Post by serge_girard »

Marc, This seems to work fine?

Serge
There's nothing you can do that can't be done...
User avatar
TopsMarc
Posts: 80
Joined: Wed Apr 06, 2016 5:57 am
Location: Belgium (Flanders)

Re: GRID : problem with delete and refresh

Post 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
Attachments
VM Recorded.zip
(672.79 KiB) Downloaded 205 times
User avatar
serge_girard
Posts: 3178
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: GRID : problem with delete and refresh

Post 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
There's nothing you can do that can't be done...
User avatar
TopsMarc
Posts: 80
Joined: Wed Apr 06, 2016 5:57 am
Location: Belgium (Flanders)

Re: GRID : problem with delete and refresh

Post 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
User avatar
TopsMarc
Posts: 80
Joined: Wed Apr 06, 2016 5:57 am
Location: Belgium (Flanders)

Re: GRID : problem with delete and refresh

Post 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
Attachments
VM Movie.zip
(2.7 MiB) Downloaded 202 times
VM.zip
(1.44 MiB) Downloaded 231 times
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: GRID : problem with delete and refresh

Post 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.
Angel Pais
Web Apps consultant/architect/developer.
User avatar
TopsMarc
Posts: 80
Joined: Wed Apr 06, 2016 5:57 am
Location: Belgium (Flanders)

Re: GRID : problem with delete and refresh

Post 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
Post Reply