GRID : an error in property "value" ?

Moderator: Rathinagiri

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

GRID : an error in property "value" ?

Post by TopsMarc »

Hi everybody.

Today I experimented with the grid, and created a program to save provinces.
Please see the movie GridValueProperty I recorded in attachment. Included also the program source and database.
The program shows the grid property "value" in a messagebox.
When there are 2 records in the database, I delete the second record. Is there then an error in the grid property "value" ?
The grid row remains 2, even when I select the first row.
(And is there a problem with the coloring ? I use cell navigation, but the whole line turns blue since then).

Kind regards, Marc
Attachments
GridValueProperty.zip
(2.39 MiB) Downloaded 263 times
PRV.zip
(1.44 MiB) Downloaded 291 times
User avatar
dragancesu
Posts: 926
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: GRID : an error in property "value" ?

Post by dragancesu »

Code: Select all

*------------------------------------------------------------------------------*
FUNCTION PRV_Button_Delete()
*------------------------------------------------------------------------------*
	LOCAL aRC   := Win_PRV.Grid_PRV.Value
	LOCAL aItem := Win_PRV.Grid_PRV.Item(aRC[1])
	
	IF PRV->(DBSeek( aItem[1] + aItem[2] ))
		IF MsgOkCancel ("Delete " + aItem[2] + " " + ALLTRIM(aItem[3]), "Controle")
					
			PRV->(DBDelete())
			PRV->(DBUnlock())
			PRV->(DBSkip())
			IF PRV->(EOF())
				PRV->(DBGobottom())
			ENDIF
			
			Win_PRV.Grid_PRV.DeleteItem( aRC[1] )
		???	Win_PRV.Grid_PRV.Value := { aRC[1], aRC[2] }   
			
			*IF aRC[1] > Win_PRV.Grid_PRV.ItemCount
			*	IF Win_PRV.Grid_PRV.ItemCount > 0
			*		aRC[1] := Win_PRV.Grid_PRV.ItemCount
			*	ENDIF
			*ENDIF
			
		ENDIF
	ENDIF
	
	PRV_RefreshData()
	Win_PRV.Grid_PRV.Setfocus
RETURN
Your program is good or pay attention to unnecessary things fashion errors or are not significant
I do not know how long a programmer, I have long used the clipper, then I found harbour and was thrilled when I started I HMG again I was at the beginning and it took me a few months to adjust, windows programming is a little different than for dos
As long as you have experience with programming when you go with the new man is a beginner (like him or not), and it must also be set to pass the cases where there are plenty of HMG
You may want to write your previous experience with programming

p.s. forget refresh button, create a function that solve after actions that seek to
User avatar
TopsMarc
Posts: 80
Joined: Wed Apr 06, 2016 5:57 am
Location: Belgium (Flanders)

Re: GRID : an error in property "value" ?

Post by TopsMarc »

The program is now modified to avoid the error in the grid property "value". See the latest attachment PRV.ZIP.
If anybody has any remarks on things that could be better, please let me know. I know Clipper (DOS, TBrowse), but I am a HMG-IDE beginner.

I do hope that the HMG development team will handle the issue I demonstrated in the movie GridValuePropery I posted earlier.
To the HMG team I would like to say you are doing a great job and make many programmers all over the world very happy.
Keep up the good work :-)

Kind regards, Marc
Attachments
PRV.zip
(1.45 MiB) Downloaded 336 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 : an error in property "value" ?

Post by serge_girard »

Very nice and you will become a real HMG-man!

Serge
There's nothing you can do that can't be done...
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: GRID : an error in property "value" ?

Post by bpd2000 »

serge_girard wrote:Very nice and you will become a real HMG-man!

Serge
+1
BPD
Convert Dream into Reality through HMG
User avatar
gfilatov
Posts: 1087
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: GRID : an error in property "value" ?

Post by gfilatov »

TopsMarc wrote:The program is now modified to avoid the error in the grid property "value". See the latest attachment PRV.ZIP.
If anybody has any remarks on things that could be better, please let me know. I know Clipper (DOS, TBrowse), but I am a HMG-IDE beginner.
...
Kind regards, Marc
Hi Marc,

Thanks for your sample :!:

I've adapted this example to a recent build of Minigui Extended Edition 16.04 with a small improvements 8-)

Please take a look for an attached code with the proposed modifications.
Attachments
prv-ex.zip
Source code
(873.12 KiB) Downloaded 293 times
Updated look of application
Updated look of application
prv.png (68.71 KiB) Viewed 5496 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
TopsMarc
Posts: 80
Joined: Wed Apr 06, 2016 5:57 am
Location: Belgium (Flanders)

Re: GRID : an error in property "value" ?

Post by TopsMarc »

Thank you all for your support. I am learning and all help is welcome.

Hi Grigory, you did some fine modifications. I like it :-) . I do get syntax errors when I try to compile your MiniGui modifications in HMG-IDE, e.g. .SetArray is invalid. Some things seem to be different in MiniGui compared to HMG-IDE. I read about Harbour, xHarbour, MiniGui, HMG, HMG-IDE, HwGui, ooHG and similar. I didn't really know what to choose. But HMG-IDE was very well documented, so I chose that one.
Is there a special reason why you use MiniGui ? Has MiniGui advantages compared to HMG-IDE ?
If there is a bug in e.g. the GRID in HMG-IDE, is the same bug then present in MiniGui or not ? Are bugs quickly repaired by the development team in MiniGui ? I do have a lot of questions :)

Kind regards, Marc
User avatar
gfilatov
Posts: 1087
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: GRID : an error in property "value" ?

Post by gfilatov »

TopsMarc wrote:Thank you all for your support. I am learning and all help is welcome.

Hi Grigory, you did some fine modifications. I like it :-) . I do get syntax errors when I try to compile your MiniGui modifications in HMG-IDE, e.g. .SetArray is invalid. Some things seem to be different in MiniGui compared to HMG-IDE. I read about Harbour, xHarbour, MiniGui, HMG, HMG-IDE, HwGui, ooHG and similar. I didn't really know what to choose. But HMG-IDE was very well documented, so I chose that one.
Is there a special reason why you use MiniGui ? Has MiniGui advantages compared to HMG-IDE ?
If there is a bug in e.g. the GRID in HMG-IDE, is the same bug then present in MiniGui or not ? Are bugs quickly repaired by the development team in MiniGui ? I do have a lot of questions :)
Hi Marc,

Thanks for your interest!

You can read about MiniguiEx on this forum at
http://hmgforum.com/viewtopic.php?f=5&t ... cial#p1319

The Minigui Team provide a new builds on the monthly basis for BCC, mingw32 and mingw64 C-compilers.

BTW I don't use any IDE personally but a free coding only :arrow:

Sorry I can not promote the MiniguiEx project on this friendly forum :oops:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: GRID : an error in property "value" ?

Post by srvet_claudio »

TopsMarc wrote:Hi everybody.

Today I experimented with the grid, and created a program to save provinces.
Please see the movie GridValueProperty I recorded in attachment. Included also the program source and database.
The program shows the grid property "value" in a messagebox.
When there are 2 records in the database, I delete the second record. Is there then an error in the grid property "value" ?
The grid row remains 2, even when I select the first row.
(And is there a problem with the coloring ? I use cell navigation, but the whole line turns blue since then).

Kind regards, Marc
Hi Mark,
this is the correct way:

Code: Select all

*------------------------------------------------------------------------------*
FUNCTION PRV_Button_Delete()
*------------------------------------------------------------------------------*
	LOCAL aRC   := Win_PRV.Grid_PRV.Value
	LOCAL aItem := Win_PRV.Grid_PRV.Item(aRC[1])
	
	IF PRV->(DBSeek( aItem[1] + aItem[2] ))
		IF MsgOkCancel ("Delete " + aItem[2] + " " + ALLTRIM(aItem[3]), "Controle")
					
			PRV->(DBDelete())
			PRV->(DBUnlock())
			PRV->(DBSkip())
			IF PRV->(EOF())
				PRV->(DBGobottom())
			ENDIF
			
			Win_PRV.Grid_PRV.DeleteItem( aRC[1] )

// Win_PRV.Grid_PRV.Value := { aRC[1], aRC[2] }  -->  assigns a wrong value when delete the last item
			
			IF aRC[1] > Win_PRV.Grid_PRV.ItemCount
				IF Win_PRV.Grid_PRV.ItemCount > 0
					aRC[1] := Win_PRV.Grid_PRV.ItemCount
               Win_PRV.Grid_PRV.Value := { aRC[1], aRC[2] }
				ENDIF
			ENDIF
         
		ENDIF
	ENDIF
	
	PRV_RefreshData()
	Win_PRV.Grid_PRV.Setfocus
RETURN

Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: GRID : an error in property "value" ?

Post by srvet_claudio »

I have fixed the problem in updating the Value property when an item is deleted in the Grid control.
Thanks for report Marc.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply