Page 1 of 2
Enter in TextBox and Button
Posted: Fri Dec 24, 2010 2:51 pm
by pctoledo
Enter does not work in TextBox and Button!
Enter in the TextBox does nothing:
Code: Select all
With Object oSenha := TextBox():New()
:Row := 80
:Col := 170
:Width := 181
:Height := 20
:Password := .t.
:OnEnter := { || MsgInfo("Enter") }
End With
Button only works with mouse click:
Code: Select all
With Object oButton1 := Button():New()
:Row := 142
:Col := 280
:Caption := 'Sair'
:OnClick := { || MsgInfo("Enter") }
End With
Clause NoSize not work in Window:
Code: Select all
With Object oModalSenha := Window():New()
:Row := 0
:Col := 0
:Width := 390
:Height := 178
:Title := 'Sistema de Ficha Qualificativa'
:Type := WND_MAIN
:OnInit := { || ( oModalSenha:Center() ) }
:Sizable := .F.
:MaxButton := .F.
:MinButton := .F.
End With
Re: Enter in TextBox and Button
Posted: Fri Dec 24, 2010 3:00 pm
by Rathinagiri
Yes. Enter and set navigation extended are not implemented as such.
Re: Enter in TextBox and Button
Posted: Fri Dec 24, 2010 3:38 pm
by pctoledo
Is there any preview to implement this?
Re: Enter in TextBox and Button
Posted: Fri Dec 24, 2010 3:41 pm
by Rathinagiri
Yes. Now I am working on VirtualGrid. It is nearing completion.
Let me try this after.
Re: Enter in TextBox and Button
Posted: Sun Jan 16, 2011 11:52 am
by l3whmg
Hi guys,
when I start to understand class... it was to understand HMG4...
Now, I write my little/personal version about HMG4 core and I find solution for enter on a textbox. I've modified some HMG4 source and this is the code.
The solution (my solution) is to specialize the "keyoard event" for any control/widget.
Anyway, I give my solution with HMG4
source name control.prg
I do some modification
Code: Select all
/*----------------------------------------------------------------------*/
METHOD OnEnter( bOnEnter ) CLASS CONTROL
IF ::lCreated
IF PCOUNT() == 0
RETURN ::bOnEnter
ELSEIF HB_ISBLOCK( bOnEnter ) == .T.
::bOnEnter := bOnEnter
RETURN NIL
ENDIF
ELSE
IF PCOUNT() == 0
RETURN ::bOnEnter
ELSEIF HB_ISBLOCK( bOnEnter ) == .T.
::bOnEnter := bOnEnter
RETURN NIL
ENDIF
ENDIF
RETURN NIL
source name textbox.prg
Added this method
Connect DoKeyBoardEvents (near line 570)
Code: Select all
IF !::lGridCellFlag
* FOR KeyBoardEventProcessing...
::oQTObject:Connect( QEvent_KeyPress , {|e| Self:DoKeyBoardEvents( e )} )
IF ValType( ::lVisible ) != 'U' ; Self:Visible := ::lVisible ; ELSE ; ::oQTObject:show() ; ENDIF
ENDIF
Code of KeyBoardEvents method
Code: Select all
/*----------------------------------------------------------------------*/
METHOD TEXTBOX:DoKeyBoardEvents( e )
LOCAL oKeyEvent := QKeyEventFromPointer( e )
LOCAL nKey := oKeyEvent:key()
LOCAL nModifiers := oKeyEvent:modifiers()
HB_SYMBOL_UNUSED( nModifiers )
IF nKey == Qt_Key_Return .OR. nKey == Qt_Key_Enter
IF HB_ISBLOCK ( ::bOnEnter )
EVAL( ::bOnEnter )
RETURN .T.
ENDIF
ENDIF
RETURN ::oQTObject:Event( oKeyEvent )
Now You can use
Code: Select all
DEFINE TEXTBOX name
ROW ....
COL....
VALUE "sdisdui"
ONENTER {|| OnEnterFunction() }
END TEXTBOX
Best regards to everyone.
Re: Enter in TextBox and Button
Posted: Mon Jan 17, 2011 12:31 pm
by pctoledo
Hi Luigi,
Thanks for the help ... I'll do a test.
Re: Enter in TextBox and Button
Posted: Thu Aug 02, 2012 9:15 pm
by Hazael
rathinagiri wrote:Yes. Now I am working on VirtualGrid. It is nearing completion.
Let me try this after.
Hello,
Do you plan to implement it in HMG 3 too?
I think HMG 4 is interesting but I really like HMG 3
Thanks
Enter in TextBox and Button
Posted: Wed Aug 28, 2013 11:25 am
by Pablo César
Olá caro Toledo,
Tem conseguido solução para o evento ENTER apresentada pelo Luigi ?
Vou intentar ajudá-lo, apesar de não ser o meu forte métodos/POO.
--
Hi dear Toledo,
Have you found a solution for the event ENTER presented by Luigi ?
I'll try to help you, even I am not dominate methods / OOP.
B.Rgds
Note: I miss the staff of HMG4 ...

Re: Enter in TextBox and Button
Posted: Fri Aug 30, 2013 3:27 pm
by pctoledo
Olá Pablo, sim consegui usar a solução apresentada pelo Luigi, até desenvolvi um pequeno programa (incompleto) para testar as funções da HMG4, mas acabei abandonando o programa.
Link para demo:
http://www.pctoledo.com.br/forum/download/smew.zip
Usuário e Senha pode digitar qualquer coisa, não estou validando. Depois, veja Cadastro / Alunos / Inclusão.
Como é apenas um teste, o formulário de Inclusão não está gravando nada em banco de dados.
--
Hi Pablo, yes I used the solution presented by Luigi, I developed a small program (incomplete) to test the functions of HMG4 but just abandoning the program.
Link to demo:
http://www.pctoledo.com.br/forum/download/smew.zip
User (Usuário) and Password (Senha) can type anything, I am not validating. Then see Cadastro / Alunos / Inclusão.
As it is only a test, the form of Inclusão is not writing anything in database.
Re: Enter in TextBox and Button
Posted: Fri Aug 30, 2013 8:52 pm
by danielmaximiliano
Gracias por compartir PCToledo !!!!