Ayuda con LOCK en BROWSE usando INPUTITEMS

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by fchirico »

---------------------------------
LOCK en BROWSE con INPUTITEMS
---------------------------------



Estimados, necesito que me ayuden con el siguiente problema:

Estoy usando HMG 2.5.8, XP-SP2, la instalación de HMG es nueva, siempre borro la vieja, uso el harbour y MinGw que biene con HMG 2.5.8, es decir a ese nivel no modifiqué nada, es más jamás instalé otras distribuciones de MiniGui que no sea la oficial ( la de Roberto ). Ahh y no soy chupamedias Ja Ja!!!


A partird de la versión HMG 2.5.3 tiene una nueva propiedad en el objeto BROWSE que se llama INPUTITEMS.
Empezé a usarla, pero cuando quiero usarla sobre una DBF que está abierta en modo SHARED tira este mensaje:

Date:08/26/2008 Time: 20:26:23
Error DBFNTX/1022 Lock required

Called from _INPLACEEDITOK(1893)
Called from (b)_BROWSEINPLACEEDIT(1579)
Called from _DOCONTROLEVENTPROCEDURE(4381)
Called from EVENTS(467)
Called from _DOMESSAGELOOP(0)
Called from _ACTIVATEWINDOW(4046)
Called from _BROWSEINPLACEEDIT(1752)
Called from _BROWSEEDIT(1354)
Called from EVENTS(1969)
Called from _DOMESSAGELOOP(0)
Called from _ACTIVATEWINDOW(4070)
Called from MAIN(79)

(IMPORTANTE!!! el error solo se produce abriendo el COMBO y moviéndose varias veces por los distintos valores, y finalmente eligiendo un valor distinto al original, si no abro el COMBO y con la flecha del teclado voy pasando por todos los valores NO se produce el error.)


yo como ven en el ejemplo tengo la propiedad LOCK en .t. entonces voy a ver la linea que marca el error (1893) en

\hmg\sources\h_browse.prg y veo que:



1891--> If lock == .t.

1893--> Replace &FieldName With r
Unlock

efectivamente está el LOCK en .t.

Por eso hago dos preguntas:

1) Ustedes pueden reproducir el error? ( recordar que el error se produce abriendo el COMBO y moviéndose varias
veces por los distintos valores, y finalmente eligiendo un valor distinto al original, si no abro el COMBO y
con la flecha del teclado voy pasando por todos los valores NO se produce el error.)

2) Se les ocurre algo ?

Muchas gracias y espero me puedan ayudar.

Saludos, Fernando Chirico.
Saludos, Fernando Chirico.
User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Re: Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by fchirico »

Por eso hago dos preguntas:

1) Ustedes pueden reproducir el error? ( recordar que el error se produce abriendo el COMBO y moviéndose varias
veces por los distintos valores, y finalmente eligiendo un valor distinto al original, si no abro el COMBO y
con la flecha del teclado voy pasando por todos los valores NO se produce el error.)

2) Se les ocurre algo ?

Muchas gracias y espero me puedan ayudar.
Perdòn, me olvidè de adjuntar los ejemplos ( faaaa!!! )

Saludos, Fernando Chirico.
Attachments
bug3.zip
(2.13 KiB) Downloaded 380 times
Saludos, Fernando Chirico.
User avatar
gfilatov
Posts: 1060
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by gfilatov »

fchirico wrote:Por eso hago dos preguntas:

1) Ustedes pueden reproducir el error? ( recordar que el error se produce abriendo el COMBO y moviéndose varias
veces por los distintos valores, y finalmente eligiendo un valor distinto al original, si no abro el COMBO y
con la flecha del teclado voy pasando por todos los valores NO se produce el error.)

2) Se les ocurre algo ?

Muchas gracias y espero me puedan ayudar.
Hello Fernando,

I confirm this problem with HMG 2.6.0 also.

Code: Select all

Harbour MiniGui Errorlog File

------------------------------------
Date:08/27/2008 Time: 10:17:43
Error DBFNTX/1022 Lock required
Called from _INPLACEEDITOK(1893) 
Called from (b)_BROWSEINPLACEEDIT(1579) 
Called from _DOCONTROLEVENTPROCEDURE(4394) 
Called from EVENTS(467) 
Called from _DOMESSAGELOOP(0) 
Called from _ACTIVATEWINDOW(4059) 
Called from _BROWSEINPLACEEDIT(1752) 
Called from _BROWSEEDIT(1354) 
Called from EVENTS(1982) 
Called from _DOMESSAGELOOP(0) 
Called from _ACTIVATEWINDOW(4083) 
Called from MAIN(79) 
There is the following fix for this problem.

Take a look for h_browse.prg at your folder hmg\source.
Seek for the following function:
*------------------------------------------------------------------------------*
Function _BrowseInPlaceEdit ( GridHandle , aValid , aValidMessages , aReadOnly , lock , append , aInputItems )
*------------------------------------------------------------------------------*
...
and place here memvar
Local abKeyBlocks := {}

Now look at code of this function further and replace

Code: Select all

...
			If lInputItems == .T.

				* Fill Items Array

				For p := 1 To Len ( aInputItems [ CellColIndex ] )
					aadd ( aItems , aInputItems [ CellColIndex ] [p] [1] )
				Next p
				
				* Fill Values Array

				For p := 1 To Len ( aInputItems [ CellColIndex ] )
					aadd ( aValues , aInputItems [ CellColIndex ] [p] [2] )
				Next p

				ii := aScan ( aValues , CellData )

				if ii == 0
					ii := 1
				endif

				DEFINE COMBOBOX Control_1
					FONTNAME BFN
					FONTSIZE BFS
					ROW 0
					COL 0
					ITEMS aItems
					WIDTH This.CellWidth 
					VALUE ii
				END COMBOBOX
...
with

Code: Select all

...
			If lInputItems == .T.

				* Fill Items Array

				For p := 1 To Len ( aInputItems [ CellColIndex ] )
					aadd ( aItems , aInputItems [ CellColIndex ] [p] [1] )
				Next p
				
				* Fill Values Array

				For p := 1 To Len ( aInputItems [ CellColIndex ] )
					aadd ( aValues , aInputItems [ CellColIndex ] [p] [2] )
				Next p

				ii := aScan ( aValues , CellData )

				if ii == 0
					ii := 1
				endif

				DEFINE COMBOBOX Control_1
					FONTNAME BFN
					FONTSIZE BFS
					ROW 0
					COL 0
					ITEMS aItems
					WIDTH This.CellWidth 
					VALUE ii
					ON DROPDOWN ( AADD(abKeyBlocks, _GetHotKey ( '_InPlaceEdit', 0, 27 )), ;
						_ReleaseHotKey ( '_InPlaceEdit', 0, 27 ), ;
						AADD(abKeyBlocks, _GetHotKey ('_InPlaceEdit', 0, 13 )), ;
						_ReleaseHotKey ( '_InPlaceEdit', 0, 13 ) )
					ON CLOSEUP ( _DefineHotKey('_InPlaceEdit', 0, 27, abKeyBlocks[1]), ;
						_DefineHotKey('_InPlaceEdit', 0, 13, abKeyBlocks[2]), ;
						abKeyBlocks := {} )
				END COMBOBOX
...
That's all!

The solution is borrowed from HMG Extended Edition.
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Re: Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by fchirico »

Gfilatov wrote:
I confirm this problem with HMG 2.6.0 also.

That's all!

The solution is borrowed from HMG Extended Edition.
Genial Gregory !!! lo probaré.

Gracias y saludos, Fernando Chirico.
Saludos, Fernando Chirico.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by Roberto Lopez »

gfilatov wrote: The solution is borrowed from HMG Extended Edition.
Grigory:

Fernando had previously reported this problem to HMG bug tracker, but I was not able to reproduce it, so, I've said to him that post the issue here.

Since I was not able to reproduce the problem, could you give some guidence about how can I do for that the error arises?

I've tested on XP SP2 and Vista SP1.

TIA.

Reagrds,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
gfilatov
Posts: 1060
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by gfilatov »

Roberto Lopez wrote: Grigory:

Fernando had previously reported this problem to HMG bug tracker, but I was not able to reproduce it, so, I've said to him that post the issue here.

Since I was not able to reproduce the problem, could you give some guidence about how can I do for that the error arises?

I've tested on XP SP2 and Vista SP1.
Roberto,

Yes, of course.

After compiling Fernando's sample I've edit a second column in grid with InputItems by mouse doubleclick.
Then I press F4 in the arised Combobox and press [ Enter ] key a twice at the dropdown list.
The aboved error arised...

I suggest to add a handling ON DROPDOWN and ON CLOSEUP events in the management of the ComboBox for Logical value too.

Code: Select all

...
			ElseIf ControlType == 'L'

				DEFINE COMBOBOX Control_1
					FONTNAME BFN
					FONTSIZE BFS
					ROW 0
					COL 0
					ITEMS { '.T.','.F.' }
					WIDTH This.CellWidth 
					VALUE If ( CellData , 1 , 2 )
					ON DROPDOWN ( AADD(abKeyBlocks, _GetHotKey ( '_InPlaceEdit', 0, 27 )), ;
						_ReleaseHotKey ( '_InPlaceEdit', 0, 27 ), ;
						AADD(abKeyBlocks, _GetHotKey ('_InPlaceEdit', 0, 13 )), ;
						_ReleaseHotKey ( '_InPlaceEdit', 0, 13 ) )
					ON CLOSEUP ( _DefineHotKey('_InPlaceEdit', 0, 27, abKeyBlocks[1]), ;
						_DefineHotKey('_InPlaceEdit', 0, 13, abKeyBlocks[2]), ;
						abKeyBlocks := {} )
				END COMBOBOX
...
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by Roberto Lopez »

gfilatov wrote:
Yes, of course.

After compiling Fernando's sample I've edit a second column in grid with InputItems by mouse doubleclick.
Then I press F4 in the arised Combobox and press [ Enter ] key a twice at the dropdown list.
The aboved error arised...

I suggest to add a handling ON DROPDOWN and ON CLOSEUP events in the management of the ComboBox for Logical value too.
Thanks!!!

I've was able to reproduce the problem now (Fernando does not mentioned F4 nor double <Enter> :) )

Thanks again!

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Re: Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by fchirico »

I've was able to reproduce the problem now (Fernando does not mentioned F4 nor double <Enter> :) )
Roberto, yo dije ...

"(IMPORTANTE!!! el error solo se produce abriendo el COMBO y moviéndose varias veces por los distintos valores, y finalmente eligiendo un valor distinto al original, si no abro el COMBO y con la flecha del teclado voy pasando por todos los valores NO se produce el error.)
"

y hay dos formas de abrir el combo: con F4 o haciendo click sobre la flechita del combo ( que es lo que yo hacía ) y si te movés por los distintos valores varias veces, es decir recorré el combo de principio a fin con las flechas arriba y abajo del teclado y si seleccionás un valor distinto del original se produce el error.

Gracias otra vez por preocuparte y cualquier prueba o ayuda que necesites avisame.

Saludos, Fernando Chirico.
Saludos, Fernando Chirico.
User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Re: Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by fchirico »

Si no puedes reproducir el error si querés por la noche podés tomar sesión de mi pc ( con VNC ) y lo vemos.

Saludos, Fernando Chirico.
Saludos, Fernando Chirico.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Ayuda con LOCK en BROWSE usando INPUTITEMS

Post by Roberto Lopez »

fchirico wrote:Si no puedes reproducir el error si querés por la noche podés tomar sesión de mi pc ( con VNC ) y lo vemos.

Saludos, Fernando Chirico.
Gracias Fernando.

Abriendo con F4 y cerrando con doble Enter he logrado reprodicir el problema.

Gracias por reportarlo.

Saludos,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply