Page 1 of 4

GRID : problem with delete and refresh

Posted: Wed Apr 06, 2016 5:21 pm
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

Re: GRID : problem with delete and refresh

Posted: Thu Apr 07, 2016 6:27 am
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

Re: GRID : problem with delete and refresh

Posted: Thu Apr 07, 2016 7:05 am
by serge_girard
Dag Marc, Welkom !

Serge

Re: GRID : problem with delete and refresh

Posted: Thu Apr 07, 2016 4:34 pm
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

Re: GRID : problem with delete and refresh

Posted: Thu Apr 07, 2016 5:12 pm
by serge_girard
Dag Marc, Ik heb je persoonlijk berichtje gestuurd. Zie private messages.

Serge

Re: GRID : problem with delete and refresh

Posted: Thu Apr 07, 2016 9:10 pm
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

Re: GRID : problem with delete and refresh

Posted: Thu Apr 07, 2016 9:29 pm
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

Re: GRID : problem with delete and refresh

Posted: Thu Apr 07, 2016 9:31 pm
by TopsMarc
Hi mr Dragancesu,
Thank you very much for your excellent vmdemo. I am studying the program.
Kind regards, Marc

Re: GRID : problem with delete and refresh

Posted: Thu Apr 07, 2016 9:33 pm
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

Re: GRID : problem with delete and refresh

Posted: Fri Apr 08, 2016 2:26 pm
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