Enter in TextBox and Button

Moderator: Rathinagiri

User avatar
pctoledo
Posts: 123
Joined: Wed Aug 25, 2010 10:45 am
Location: Araçatuba - SP - Brazil
Has thanked: 3 times
Been thanked: 7 times
Contact:

Enter in TextBox and Button

Post by pctoledo » Fri Dec 24, 2010 2:51 pm

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
Regards/Saludos,

Toledo

Clipper On Line

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Fri Dec 24, 2010 3:00 pm

Yes. Enter and set navigation extended are not implemented as such.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
pctoledo
Posts: 123
Joined: Wed Aug 25, 2010 10:45 am
Location: Araçatuba - SP - Brazil
Has thanked: 3 times
Been thanked: 7 times
Contact:

Post by pctoledo » Fri Dec 24, 2010 3:38 pm

Is there any preview to implement this?
Regards/Saludos,

Toledo

Clipper On Line

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Fri Dec 24, 2010 3:41 pm

Yes. Now I am working on VirtualGrid. It is nearing completion.

Let me try this after.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Post by l3whmg » Sun Jan 16, 2011 11:52 am

Hi guys,
when I start to understand class... it was to understand HMG4... :mrgreen:
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

Code: Select all

   METHOD DoKeyBoardEvents
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.
Luigi from Italy
www.L3W.it

User avatar
pctoledo
Posts: 123
Joined: Wed Aug 25, 2010 10:45 am
Location: Araçatuba - SP - Brazil
Has thanked: 3 times
Been thanked: 7 times
Contact:

Post by pctoledo » Mon Jan 17, 2011 12:31 pm

Hi Luigi,

Thanks for the help ... I'll do a test.
Regards/Saludos,

Toledo

Clipper On Line

User avatar
Hazael
Posts: 109
Joined: Thu Jun 24, 2010 11:37 am
Location: France

Post by Hazael » Thu Aug 02, 2012 9:15 pm

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
Harbour | GTWVT | MingW | Visual Studio Code

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Wed Aug 28, 2013 11:25 am

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 ... :cry:
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
pctoledo
Posts: 123
Joined: Wed Aug 25, 2010 10:45 am
Location: Araçatuba - SP - Brazil
Has thanked: 3 times
Been thanked: 7 times
Contact:

Post by pctoledo » Fri Aug 30, 2013 3:27 pm

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.
Regards/Saludos,

Toledo

Clipper On Line

User avatar
danielmaximiliano
Posts: 2140
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 155 times
Been thanked: 23 times
Contact:

Post by danielmaximiliano » Fri Aug 30, 2013 8:52 pm

Gracias por compartir PCToledo !!!!
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

Post Reply