Function InputWindow()

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Function InputWindow()

Post by Pablo César »

* Two bugs was fixed:
  1. When at _DefineMaskedTextbox (wrong array address.).
  2. Corrected to MASKEDTEXT at SetMethodCode.
* Enhanced:
  1. Added new behaviour when is focused changes font color.
  2. New Demo is attched file, just to prove full retrocompatibility of the updated InputWindow2 to the old InputWindow:
    Screen3.png
    Screen3.png (242.89 KiB) Viewed 4470 times
    Please note Field 6 is ausent in the old InputWindow, due is lack of numeric textbox for integers.
    See at field 1, labels in old InputWindow version is cutting (no way to fix width size).
Probably I will find a way to include Grid at next releases.

<Code source files were removed because there is a updated version ahead of this topic>

I hope you enjoy it ! :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Function InputWindow()

Post by Pablo César »

Dear Claudio,

I wish to use HMG_MessageBoxTimeout at xIfEmpty(), instead of: hb_IdleSleep( 0.5 )
But the implementation of HMG_MessageBoxTimeout is interfering with the event. How could I use it properly ?
Screen2.png
Screen2.png (20.83 KiB) Viewed 4459 times
Best Regards,
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: Function InputWindow()

Post by apais »

Hello Pablo

I'd like that fields 2 and 4 could be exited by pressing the ENTER KEY ...

------------------------------------------------------------------------------------------------

Hola Pablo

Sería posible de que los campos 2 ( checkbox) y 4 (date field ) se pudiera salir con ENTER y no solamente con TAB ?
Si tambien se pudieran usar las teclas de flecha arriba/abajo sería genial !!
Gracias de antemano !!

Angel
Angel Pais
Web Apps consultant/architect/developer.
HW_apache (webserver modules) co-developer.
HbTron (Html GUI for harbour desktop hybrid apps) co-developer.
https://www.hbtron.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: Function InputWindow()

Post by Pablo César »

apais wrote:Sería posible de que los campos 2 ( checkbox) y 4 (date field ) se pudiera salir con ENTER y no solamente con TAB ?
Hola Angel,

Para que el evento ENTER ocurra de una forma convencional como con TextBox, ComboBox, etc.,

1. En el caso del CheckBox, creo que deberia hacerse cambios en el source. Porque se ve que el código posue:
  • _HMG_SYSDATA [ 16 ] [k] := _HMG_SYSDATA [ 266 ] (La descricion es:_HMG_ActiveTabButtons)

    No sé si es posible adicionar este nuevo evento (ENTER) internamente al CheckBox. Talvez Claudio pueda respondernos.

    Otra salida, seria crea un evento para este control, lo que dejaria de ser una rutina genérica y pasaria ser exclusiva.
2. Ahora en el DatePicker, verifiqué que podria utilizarse sin problemas y está corregido. Gracias por avisar.
  • Para resolverlo ahora, en la funcion SetMethodCode en el Case cControlType = "DATEPICK" agregale:
    Screen4.png
    Screen4.png (20.29 KiB) Viewed 4430 times
apais wrote:Si tambien se pudieran usar las teclas de flecha arriba/abajo sería genial !!
Voy a ver como hacerlo.
apais wrote:Gracias de antemano !!
Es un gusto, Angel ! Gracias por tu interés e ideas que ayudan a mejorar. :)

Image
apais wrote:It would be possible that the 2 fields (checkbox) and 4 (date field) could get away with and not just ENTER TAB?
Hello Angel,

For the ENTER event occurs in a conventional manner as TextBox, ComboBox, etc.,

1. For the CheckBox, I think it should be changes to the source. Because it looks that code has:
  • _HMG_SYSDATA [ 16 ] [k] := _HMG_SYSDATA [ 266 ] (Description is:_HMG_ActiveTabButtons)

    Do not know if it's possible to add the new event (ENTER) internally to CheckBox. Maybe Claudio can answer us.

    Another way would be created an event for this control, which would cease to be a generic routine and would happen to be exclusive for that especific control.
2. Now in the DatePicker, I verified that could be used without problems and it was corrected. Thank you for your advise.
  • To solve now, please edit the SetMethodCode function in the Case cControlType = "DATEPICK" and add this:
    Screen4.png
    Screen4.png (20.29 KiB) Viewed 4430 times
apais wrote:If you could also use the arrow keys up/down would be great !!
I'll see how to do it.

Kind regards

To everybody,

I loose too much time translating... :evil:

I hope you're reading this, please take your time and make me think that all this translations is not in vain... :roll:
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Function InputWindow()

Post by Pablo César »

Hola Angel, fijate como fué resolvido.
Pablo César wrote:
apais wrote:If you could also use the arrow keys up/down would be great !!
I'll see how to do it.
Very easy ! :D

Remember Angel, now you can add HotKeys assigning functions of each. And I've added this:
Pantalla1.png
Pantalla1.png (28.27 KiB) Viewed 4409 times
This changing behaviour, we have to take caution, specially for EditBox and proper behaviour but for the rest, is working Ok ! :D

Enjoy it !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: Function InputWindow()

Post by apais »

Thank you very much Pablo !
Angel Pais
Web Apps consultant/architect/developer.
HW_apache (webserver modules) co-developer.
HbTron (Html GUI for harbour desktop hybrid apps) co-developer.
https://www.hbtron.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Function InputWindow()

Post by Pablo César »

Siempre un placer, Angel ! :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Function InputWindow()

Post by srvet_claudio »

Pablo César wrote:Dear Claudio,

I wish to use HMG_MessageBoxTimeout at xIfEmpty(), instead of: hb_IdleSleep( 0.5 )
But the implementation of HMG_MessageBoxTimeout is interfering with the event. How could I use it properly ?
Screen2.png
Best Regards,
See Pablo:

Code: Select all

Static Function xIfEmpty()
If Empty(This.Value)

StopControlEventProcedure (This.Name, '_InputWindow', .F.)

   SetProperty('_InputWindow',This.Name,'BackColor',RED)
   PlayBeep()
   hb_IdleSleep( 0.5 )

   nTypeButton = MB_ICONHAND + MB_OK   // (i_MsgBox.ch)
   x:= MessageBoxTimeout ("No empty field is allowed !", "Attention", nTypeButton, 3000)
   DoMethod('_InputWindow',This.Name,'SetFocus')
   SetProperty('_InputWindow',This.Name,'BackColor',WHITE)

StopControlEventProcedure (This.Name, '_InputWindow', .T.)

Endif
Return Nil
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Function InputWindow()

Post by Pablo César »

Thank you Claudio !

I have forgoten that need to be stopped all events and when calling MessageBoxTimeout without events interferences.

But something is interfering about colour of controls, stayed checkcolor in white backcolor and loose all events after first time MessageBoxTimeout is displayed at every empty/zero control. :o

B.Rgds.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Function InputWindow()

Post by srvet_claudio »

Pablo César wrote:Thank you Claudio !

I have forgoten taht need to be stopped all events and when calling MessageBoxTimeout without events interferences.

But something is interfering about colour of controls, stayed checkcolor in white backcolor and loose all events after first time MessageBoxTimeout is displayed at every empty/zero control. :o

B.Rgds.
I'm sorry Pablo,
I inverted the order of call the StopControlEventProcedure() function with the parameters .T. and .F. , this way is more security.

Code: Select all

Static Function xIfEmpty()
Local cControlName := This.Name

IF ValType (This.Value) == "N"   // Empty() --> return .T. if number == 0
   RETURN NIL
ENDIF

If Empty(This.Value)

DISABLE CONTROL EVENT &cControlName OF _InputWindow
   SetProperty('_InputWindow',This.Name,'BackColor',RED)
   PlayBeep()
   hb_IdleSleep( 0.5 )

   nTypeButton = MB_ICONHAND + MB_OK   // (i_MsgBox.ch)
   x:= MessageBoxTimeout ("No empty field is allowed !", "Attention", nTypeButton, 3000)
   DoMethod('_InputWindow',This.Name,'SetFocus')
   SetProperty('_InputWindow',This.Name,'BackColor',WHITE)
ENABLE CONTROL EVENT &cControlName OF _InputWindow
Endif
Return Nil
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply