GRID : problem with delete and refresh

Moderator: Rathinagiri

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

GRID : problem with delete and refresh

Post by TopsMarc »

Dear Sirs,

I am having troubles with the control Grid.
Could you help me please ? I included my sources and database in attachment in a zip-file.

I use Windows 10 Home, and installed HMG.3.4.2.Setup.exe.
Open the project VM.hbp. When I run the project and click 'articles' and 'valuta', my database VM.DBF is shown. I have 3 records

The current record is 'BEF'. I press the DEL button to delete the current record. There are 2 records left, 'EUR' and 'NLG'. Ok so far. (see IMG 2)

The current record is now 'EUR'. I press the DEL button.

Instead of the NLG-record, I see the EUR-record. (see IMG 3)
I don't understand why I don't see the NLG-record now.

And when I press the 'Refresh' button, again the EUR record is shown, and not the NLG record.
What am I doing wrong ? Or could there be a bug in the .save and .delete and .refresh method ?

If you need more information, please ask me.

Kind regards,
Marc Tops
Attachments
IMG 2.png
IMG 2.png (33.37 KiB) Viewed 7194 times
IMG 3.png
IMG 3.png (26.68 KiB) Viewed 7194 times
VM.zip
(3.47 KiB) Downloaded 314 times
User avatar
dragancesu
Posts: 921
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: GRID : problem with delete and refresh

Post by dragancesu »

The order in the table and the grid is not the same

Code: Select all

FUNCTION KR_Button_Del()

        msgingo( 'Order in grid : ' +  str(Win_KR.KR_Grid_KR.Value) )
        msgingo( 'Order in dbf : ' +  str(recno()) )

	Win_KR.KR_Grid_KR.Delete
	Win_KR.KR_Grid_KR.Save
RETURN
and you must know when line in grid is actual, MUST BE SELECTED (just click on line), only refresh is not solution, try

Win_KR.KR_Grid_KR.Value :=1
Win_KR.KR_Grid_KR.Refresh // if you want go to top line in grid

Welcome to HMG
User avatar
serge_girard
Posts: 3169
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 »

Dag Marc, Welkom !

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 mr Dragancesu.
Thank you for your suggestions. I entered these lines
msginfo( 'Order in grid : ' + str(Win_KR.KR_Grid_KR.Value[1]) + ' ' + str(Win_KR.KR_Grid_KR.Value[2]) )
msginfo( 'Order in dbf : ' + str(recno()) )
and I get it that recno() is not the same as the order in the grid.
I tried as you suggested clicking on the line before hitting the DEL-button. But the result was the same as before.

For the refresh, I also tried as you suggested
Win_KR.KR_Grid_KR.Value :=1
Win_KR.KR_Grid_KR.Refresh
Again the result was the same as before. The refresh doesn't work.

I don't understand why, but the content of the grid is incorrect when I use delete , save or refresh method.

Kind regards, Marc


Dag Serge,
Blij hier al een taalgenoot te vinden. Groeten uit de Kempen.
Mvg, Marc
User avatar
serge_girard
Posts: 3169
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 »

Dag Marc, Ik heb je persoonlijk berichtje gestuurd. Zie private messages.

Serge
There's nothing you can do that can't be done...
User avatar
dragancesu
Posts: 921
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: GRID : problem with delete and refresh

Post by dragancesu »

Transition from Clipper to HMG not easy for me, I think it's easier to use the browse

It's been half a year until I made my way to standardize applications but now look like in demo

I do not use HMG-ide

HMG is excellent
Attachments
vmdemo.zip
(3.84 KiB) Downloaded 297 times
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 »

Instead of deleting a record in a grid with the delete and save method that doesn't seem to work (and I don't know why not) ...
Win_KR.KR_Grid_KR.Delete
Win_KR.KR_Grid_KR.Save

I tried it now like this ...
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

It didn't work either.
When the BEF record is deleted, recno() becomes 2, and the current record in the grid becomes EUR. Fine so far.
When the EUR record is deleted, recno() becomes 3, but the current record in the grid doesn't become NLG, but it is again EUR, and NLG is not shown in the grid. I don't get that at all.

And the refresh button ...
Win_KR.KR_Grid_KR.Refresh
Win_KR.KR_Grid_KR.Setfocus
also again shows EUR instead of NLG. Why is that ?

it is so frustrating not being able to use the grid without such errors, and I can't figure out what I am doing wrong. Or is this a serious bug ?

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 mr Dragancesu,
Thank you very much for your excellent vmdemo. I am studying the program.
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 »

Dag Serge,
Voorlopig zie ik bij private messages nog niets staan. Misschien zit er wat vertraging op. Ik hou het in de gaten.
Mvg, 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 »

Hola Marc

Si tratas de hacerlo de la siguiente forma, te da el mismo resultado ?
--------------------------------------------------------------------------------------
Hello Marc

If you try to do as follows, it gives you the same result?



see the following: viewtopic.php?f=20&t=4666&p=44516#p44516
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply