Problem with Browse

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
Mario Mansilla
Posts: 271
Joined: Wed Aug 13, 2008 2:35 pm
Location: Córdoba - Argentina

Problem with Browse

Post by Mario Mansilla »

Hola :
Les envio un ejemplo simple en la cual se puede ver el comportamiento extraño del browse .
El problema es que el browse no se posiciona en el primer registro .
Esto sucede cuando la funcion Busca2_articulo() esta en el evento onchange del combo_2 . Sacando esta funcion del evento onchange o bien colocandola en el onenter el browse se posiciona correctamente .
Otro comportamiento extraño sucede en el textbox que muestra el precio . Cuando el precio es cero el textbox aparece en blanco salvo que el precio sea mayor a cero (0.00) .
Ahora bien una vez que el textbox muestra un precio superior a cero , a partir de alli muestra el cero correctamente .

No se si estoy cometiendo algun error o bien es un bug .
HMG 3.0

Saludos .
Mario Mansilla

Hi:
I sent a simple example which you can see the strange behavior of the browse.
The problem is that the browser no stand on the first record.
This happens when Busca2_articulo function () is in the onchange event of combo_2. Taking this function onchange event or placed on the OnEnter the browse is positioned correctly.
Another strange behavior happens in the textbox that shows the price. When the price is zero, the textbox is blank unless the price is greater than zero (0.00).
But once the textbox shows a price greater than zero, from zero shows correctly there.

Do not know if I'm doing something wrong or is it a bug.
HMG 3.0

Greetings.
Mario Mansilla
Attachments
Test.rar
(693.46 KiB) Downloaded 327 times
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Problem with Browse

Post by mol »

Hola Mario!
I think Your problem lays in function:

Code: Select all

*--------------------------
Procedure Buscar2_Articulo()
*--------------------------

Posicion := Main.Combo_2.Value

Plu->(DbSeek(Strzero(Posicion,2)))

Main.Browse_1.Value := Recno()
Main.Browse_1.Refresh

Return
During init time, this function is called and searches Main.Combo_2.Value which is equal to 1 - so strzero(Posicion,2) gives "01" . This action moves Browse_1 pointer to record 010000 ASD
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Problem with Browse

Post by mol »

Mario Mansilla wrote: Another strange behavior happens in the textbox that shows the price. When the price is zero, the textbox is blank unless the price is greater than zero (0.00).
But once the textbox shows a price greater than zero, from zero shows correctly there.
Mario Mansilla

I think you should define Main.Text_4.Value to 0.00 (or any other numeric value, eg. 100.11) to initialize this control.

Besides, it's interesting, why numeric fields need initialization.

(I think, Roberto can answer it....)

Best regards, Marek
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Problem with Browse

Post by Roberto Lopez »

mol wrote:
Mario Mansilla wrote: Another strange behavior happens in the textbox that shows the price. When the price is zero, the textbox is blank unless the price is greater than zero (0.00).
But once the textbox shows a price greater than zero, from zero shows correctly there.
Mario Mansilla

I think you should define Main.Text_4.Value to 0.00 (or any other numeric value, eg. 100.11) to initialize this control.

Besides, it's interesting, why numeric fields need initialization.

(I think, Roberto can answer it....)

Best regards, Marek
I must to test deeply to give an opinion and I had not enough time to do it yet.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Problem with Browse

Post by mol »

It's good this problem is localized and the solution is easy - it's enough to define value and everything works OK.
Mario Mansilla
Posts: 271
Joined: Wed Aug 13, 2008 2:35 pm
Location: Córdoba - Argentina

Re: Problem with Browse

Post by Mario Mansilla »

Hola Mol :
Muchas gracias por tu ayuda , no comprendia que ocurria , no evalue lo que ocurria en el instante inicial .
Lo solucione modificando la funcion para que solo se ejecute cuando la busqueda sea por ese item .

En cuanto al TextBox numerico inicializare los valores con cero .

Saludos cordiales
Mario Mansilla


Hello Mol:
Thank you very much for your help, did not understand that does not assess what happened in the initial instant.
I solved by changing the function to only run when the search is for that item.

As for the TextBox inicializare numeric values with zero.

Best regards
Mario Mansilla

*--------------------------
Procedure Buscar2_Articulo()
*--------------------------

If Main.Combo_1.Value = 2
Posicion := Main.Combo_2.Value

Plu->(DbSeek(Strzero(Posicion,2)))

Main.Browse_1.Value := Recno()
Main.Browse_1.Refresh
Endif

Return
Post Reply