Page 2 of 12

Function InputWindow()

Posted: Sat Dec 27, 2014 4:57 pm
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 4573 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

Function InputWindow()

Posted: Sat Dec 27, 2014 5:10 pm
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 4562 times
Best Regards,

Re: Function InputWindow()

Posted: Sat Dec 27, 2014 6:26 pm
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

Re: Function InputWindow()

Posted: Sat Dec 27, 2014 8:45 pm
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 4533 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 4533 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:

Function InputWindow()

Posted: Sat Dec 27, 2014 9:40 pm
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 4512 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 !

Re: Function InputWindow()

Posted: Sat Dec 27, 2014 10:29 pm
by apais
Thank you very much Pablo !

Function InputWindow()

Posted: Sat Dec 27, 2014 10:36 pm
by Pablo César
Siempre un placer, Angel ! :D

Re: Function InputWindow()

Posted: Sun Dec 28, 2014 12:09 am
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

Function InputWindow()

Posted: Sun Dec 28, 2014 1:55 am
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.

Re: Function InputWindow()

Posted: Sun Dec 28, 2014 2:46 am
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