Harbour MiniGUI 2.6.7

HMG announcements; Latest HMG-related news, releases, fixes and updates.

Moderator: Rathinagiri

User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Harbour MiniGUI 2.6.7

Post by mol »

Thank you, but I have my own idea...
I wrote this, because I think that is a bug in HMG, which allows such problems.
Normally, no one pushes simultanously mouse button and enter key in the same time, but...

Regards, Marek
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Harbour MiniGUI 2.6.7

Post by mol »

gfilatov wrote:
mol wrote:I've compiled program using:
Harbour MiniGUI 2.0.031 (2007.06.26)
Harbour MiniGUI IDE 2.0 Build 2007.02.22

and have done test - press left mouse button on SAVE button and ENTER on keyboard - the same effect - two exactly the same records in database - function which save data was called two times and after that window was released.

How it is possible?

It is not big problem, but exists...
Hello Marek,

Try the following workaround with a busy flag as below:

Code: Select all

/*
 * MiniGUI Hello World Demo
 * (c) 2002-2004 Roberto Lopez <harbourminigui@gmail.com>
*/

#include "minigui.ch"

Static lBusy := .F.

Procedure Main

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 400 ;
		HEIGHT 200 ;
		TITLE 'Hello World!' ;
		MAIN ;
		ON INIT OpenTables() ;
		ON RELEASE CloseTables()

		DEFINE BUTTON Button_1
			ROW	10
			COL	10
			CAPTION 'Save'
			ACTION Save()
		END BUTTON

	END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return

Procedure Save

if !lBusy
	lBusy := .T.
	append blank
	inkey(.2)
	lBusy := .F.
endif

ThisWindow.Release

Return

Procedure OpenTables()

	Use Test
	zap
	Go Top

Return

Procedure CloseTables()
	Use
Return
I hope that give you an idea.

Hello Grigori
I was wonder if your idea is good.
I've modified my SAVE function using flag lBusy (it must be declared inside function, not as global variable...)

I've got two exactly the same records....

Below I paste code of my function. Some text are in Polish, but I have no time now to translate it to English, I think, you will be able to understand it...
Marek

*OknoNoweZlecenie you can translate as Window_NewOrder
function ZapiszZlecenie
static lBusyProc := .f.
BEGIN SEQUENCE

if lBusyProc
break
endif

lBusyProc := .t.
select("zlec")

select("palety")
DBSeek(strtran(OknoNoweZlecenie.T_PelnyNrPalety.Value," ",""))

if !found()
Ostrzez("Niespójne dane!!! Brak palety podanej w zleceniu!")
break
//return
endif
reclock(0)
replace ;
NrZlecenia with ATypyZlecen[OknoNoweZlecenie.C_TypZlecenia.Value]+OknoNoweZlecenie.T_RkZlecenia.Value +OknoNoweZlecenie.T_NrZlecenia.Value,;
NrCzesci with OknoNoweZlecenie.T_NrCzesci.Value,;
Data_Wyjsc with OknoNoweZlecenie.D_DataZlecenia.Value
unlock

select("zlec")
if lNoweZlecenie
Addrec(0)
else
//Reclock(0)
//zablokowane przy otwarciu okna...
endif


if lNoweZlecenie
replace;
RkZlecenia with OknoNoweZlecenie.T_RkZlecenia.Value,;
NrZlecenia with OknoNoweZlecenie.T_NrZlecenia.Value
endif
replace;
TypZleceni with ATypyZlecen[OknoNoweZlecenie.C_TypZlecenia.Value],;
PelnyNrPal with OknoNoweZlecenie.T_PelnyNrPalety.Value,;
Data_Zlec with OknoNoweZlecenie.D_DataZlecenia.Value,;
Polprodukt with OknoNoweZlecenie.T_Polprodukt.Value,;
NrCzesci with OknoNoweZlecenie.T_NrCzesci.Value,;
Ilosc with OknoNoweZlecenie.T_Ilosc.Value,;
IloscPalet with palety->ilosc_dost

unlock
RECOVER
MsgBox("Second time!!!")
return
END SEQUENCE

lBusyProc := .f.
Oknozlecenia.B_Zlecenia.Refresh
OknoNoweZlecenie.Release
return
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Harbour MiniGUI 2.6.7

Post by mol »

Hello guys!!!

I think that is some problem in hmg with "ON KEY" statement
I wanted to use F1 (it may be any different key... like Alt-H) to call dictionary window" - a table with clients for sale documents.
Also I defined button to call this window.

Everything is OK, when I use mouse or keyboard to press button.
But something is wrong when I use button's hot key or then I use "ON KEY F1...."
I think that fFunction under button is called two times in this situation.
My program is too complex to put it on this forum.
I tried to write a little example to test this situation, but - you know - in these cases everything looks OK.

Maybe someone can test it by bounding function key - F1 or f2 - to call function bounded to button now.

I know that my English is poor, but I hope that somebody has undestood me....

Best regardsin new year, Marek
Post Reply