TGET Ignore VALID

TGET Ignore VALID

Postby MGA » Tue Dec 24, 2013 11:55 am

Sr. Antonio, código abaixo demonstra que é possível ignorar o VALID de um GET pressionando VK_F3.

local oDlg, cTest := SPACE(20), oBut[2]

DEFINE DIALOG oDlg TITLE "VK_F3 ignore VALID"

odlg:bkeydown:={|nkey| if(nkey==VK_F3,oBut[1]:click(),)}

@ 1, 3 GET cTest picture "@!" valid .f.

@ 3, 5 BUTTON oBut[1] prompt "&Ok" SIZE 40, 12 ACTION MsgInfo( "Any action here. Ignore VALID problem!" )

@ 3, 16 BUTTON oBut[2] prompt "&Cancel" SIZE 40, 12 ACTION oDlg:End() cancel

ACTIVATE DIALOG oDlg CENTERED


Existe uma solução para este problema?
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: TGET Ignore VALID

Postby Antonio Linares » Thu Dec 26, 2013 4:06 pm

Please try it this way:

@ 1, 3 GET oGet VAR cTest picture "@!" valid .f.

odlg:bkeydown:={|nkey| if(nkey==VK_F3 .and. oGet:lValid(),oBut[1]:click(),)}
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TGET Ignore VALID

Postby Ariel » Thu Dec 26, 2013 4:27 pm

Antonio,

El tema es si tenes mas de 1 control (GET), debes hacer eso x cada uno ?? Xq sino se dispara igual...

Salu2, Ariel.
Ariel
 
Posts: 374
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina

Re: TGET Ignore VALID

Postby Antonio Linares » Thu Dec 26, 2013 4:30 pm

Se podría hacer:

odlg:bkeydown:={|nkey| if(nkey==VK_F3 .and. oWndFromHwnd( GetFocus() ):lValid(),oBut[1]:click(),)}

lo que no entiendo cual es la razón de asignar ese codeblock al diálogo.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TGET Ignore VALID

Postby MGA » Thu Dec 26, 2013 4:57 pm

Senhor Antonio,

é possível uma alteração na classe TGET ou TBUTTON para evitar alteração no sistema inteiro?
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: TGET Ignore VALID

Postby Antonio Linares » Thu Dec 26, 2013 7:12 pm

Please try this change in Class TButton in Method Click line 162 and let me know if it is fine for you:

Code: Select all  Expand view
     if ::bAction != nil .and. ::lValid()  // here !!!
         Eval( ::bAction, Self )
      endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TGET Ignore VALID

Postby MGA » Fri Dec 27, 2013 10:57 am

muito obrigado, vou testar e posto o resultado!
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: TGET Ignore VALID

Postby MGA » Fri Dec 27, 2013 1:14 pm

Sr. Antonio,

Não funciona:

if ::bAction != nil .and. ::lValid() // here !!!
Eval( ::bAction, Self )
endif

:(
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: TGET Ignore VALID

Postby Rick Lipkin » Fri Dec 27, 2013 2:10 pm

SGS

Forgive my spanish .. if you are trying to close a dialog without the valid firing try this ..

Code: Select all  Expand view

oBtn[2]:lCancel := .t.
 


Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2618
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TGET Ignore VALID

Postby cnavarro » Fri Dec 27, 2013 2:55 pm

SGS wrote:Sr. Antonio,

Não funciona:

if ::bAction != nil .and. ::lValid() // here !!!
Eval( ::bAction, Self )
endif

:(


Prueba asi:
Code: Select all  Expand view


#include "fivewin.ch"

Function Main()

local oDlg
local cTest := SPACE(20)
local oBut  := { , } //[2]
local oGet

DEFINE DIALOG oDlg TITLE "VK_F3 ignore VALID"

//oDlg:bKeydown := {| nkey | if( nkey == VK_F3, oBut[1]:click(), )}
oDlg:bKeydown := {| nkey | if( nkey == VK_F3, PulsaF3( oDlg, oBut ), )}

@ 1, 3 GET oGet VAR cTest picture "@!" valid ( .F. )

@ 3, 5 BUTTON oBut[1] prompt "&Ok" SIZE 40, 12 ACTION MsgInfo( "Any action here. Ignore VALID problem!" )

@ 3, 16 BUTTON oBut[2] prompt "&Cancel" SIZE 40, 12 ACTION oDlg:End() CANCEL

ACTIVATE DIALOG oDlg CENTERED

Return nil

//---------------------------------------------------

Function PulsaF3( oDlg, oBtt )

if oDlg:oCtlFocus:lValid()
   oBtt[1]:click()
else
   oDlg:oCtlFocus:SetFocus()
endif
Return nil

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: TGET Ignore VALID

Postby cnavarro » Fri Dec 27, 2013 7:40 pm

Funciona igual si se modifica la Clase TWindow en el metodo KeyDown


Code: Select all  Expand view


METHOD KeyDown( nKey, nFlags ) CLASS TWindow

...../...

   if ::oWnd != nil .and. IsChild( ::oWnd:hWnd, ::hWnd )
     
       if ::oWnd:oCtlFocus:lValid()                // He añadido
         ::oWnd:KeyDown( nKey, nFlags )
      endif                                                  //
   endif

return nil

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: TGET Ignore VALID

Postby MGA » Tue Dec 31, 2013 12:19 am

Muito obrigado, vou testar!
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 83 guests