Page 1 of 1

Valid , sbutton Cancel no me funciona

Posted: Mon Jan 16, 2006 12:24 am
by Databaselab2002
Estimado Colegas

Como puedo hacer que me funcione cancel de sbutton y no que me
ejecute la funcion del valid,

Muchas Gracias
Fabian
Databaselab2002@yahoo.com.ar



@ 0.8,09 Get mg2 var xmesa Of oDlg size 40,30 font oFont Picture "999" Valid busmes((xmesa,Odlg,mg2,nkey,xturno,xadicion),.t.) && update


@ 0.8 , 16+20 sbutton b2 FILENAME "ok1.bmp" size 24,24 OF oDlgd cancel TEXT ON_BOTTOM NO BOX action local(xtelefo,Odlgd,otelefo,olbx1)

Posted: Mon Jan 16, 2006 11:05 am
by karinha
@ 0.8 , 16+20 sbutton b2 FILENAME "ok1.bmp" size 24,24 OF oDlgd ;
TEXT ON_BOTTOM NO BOX action local( (xtelefo,Odlgd,otelefo,olbx1), oDlgD:End() ) CANCEL

Posted: Mon Jan 16, 2006 4:21 pm
by Joel Andujo
Fabian vas a tener que modificar la clase Control el método KillFocus agrega TSButton como en este ejemplo :

METHOD KillFocus( hCtlFocus ) CLASS TControl

local oWnd

if ! Empty( hCtlFocus ) .and. ::bValid != nil .and. WndParents( hCtlFocus, ::hWnd ) .and. ;
( oWnd := oWndFromhWnd( hCtlFocus ) ) != nil .and. ;
Upper( oWnd:Classname() ) $ "TBUTTON;TBTNBMP;TSBUTTON" .and. ;
( oWnd:lCancel != nil .and. oWnd:lCancel .and. ;
( ::oWnd:nLastKey != VK_TAB .and. ::oWnd:nLastKey != VK_RETURN .and. ;
::oWnd:nLastKey != VK_DOWN .and. ::oWnd:nLastKey != VK_UP ) ) // JAAM Agregue ";TSBUTTON" para que le haga caso a
::oWnd:lValidating = .t. // la clusula CANCEL en los botones
::oWnd:nLastKey := 0
::ForWhen()
::oWnd:lValidating = .f.
::LostFocus()
return nil
else
if Upper( GetClassName( hCtlFocus ) ) == "TBTNBMP"
::oWnd:nLastKey := 0 // it fixes TBtnBmp CANCEL clause
endif
endif

// in FiveWin++ lValidating comes as nil sometimes
if ! Empty( hCtlFocus ) .and. ( ::oWnd:lValidating == nil .or. ! ::oWnd:lValidating ) ;
.and. IsWindowVisible( ::oWnd:hWnd ) .and. WndParents( hCtlFocus, ::hWnd )
PostMessage( ::hWnd, FM_LOSTFOCUS, hCtlFocus )
endif

return ::LostFocus( hCtlFocus )

Saludos
Joel Andujo