TGET, ACTION, VALID problem?

TGET, ACTION, VALID problem?

Postby dutch » Fri Mar 26, 2010 5:06 pm

Dear All,

I use xHarbour 1.2.1 (FW), FWH 9.07.

I use GET ACTION VALID. When I click on button the valid will ignore (pass oGet1 even cVar is empty). If I use enter key valid is working fine.
Example
=======
Code: Select all  Expand view
#Include "FiveWin.Ch"

Function Main()
   Local oDlg
   Local oGet1, oGet2
   local cVar := space( 10 )
   local cVar2 := space(10)

   DEFINE DIALOG oDlg from 0,0 to 400,400 pixel

   @ 15,15 get oGet1 var cVar picture "@!"  bitmap "..\bitmaps\chkyes.bmp" action( msginfo( "action" ) );
   size 120,12 of oDlg pixel ;
   valid !empty(cVar)

   @ 45,15 get oGet2 var cVar2 picture "@!" pixel of odlg size 100,12

   ACTIVATE DIALOG oDlg
 
 return nil
 


Thanks for any help and comment.
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: TGET, ACTION, VALID problem?

Postby ukoenig » Fri Mar 26, 2010 5:46 pm

With the Action, You loose the Focus.
I think that solves the Problem :

@ 15,15 get oGet1 var cVar picture "@!" bitmap "..\bitmaps\chkyes.bmp" ;
action( msginfo( "action" ), oGet1:Setfocus() );
size 120,12 of oDlg pixel ;
valid !empty(cVar)

Best regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TGET, ACTION, VALID problem?

Postby dutch » Fri Mar 26, 2010 6:04 pm

Dear Uwe,

Thank you for your reply, it work fine but how can I do without put oGet1:SetFocus() (How to change in TGET.PRG?). Because it change in classes only one time and do not put in all GET ACTION VALID.

METHOD CreateButton() CLASS TGet
local oThis := Self
local hBitmap
local nBmpWidth := 1
local lFileBmp := .t.

if ValType( ::bAction ) == "B" .and. Upper( ::ClassName() ) == "TGET"

if Empty( ::cBmpName )
@ -1, ::nWidth - ::nHeight BUTTONBMP ::oBtn OF Self ;
ACTION ( Eval( oThis:bAction, oThis ), oThis:SetFocus() ) ;
SIZE ::nHeight - 5, ::nHeight - 5 PIXEL
if Empty( ::oBtn:hBitmap )
::oBtn:SetText( "..." )
endif
else

hBitmap = If( ( lFileBmp := File( ::cBmpName ) ), ReadBitmap( 0, ::cBmpName ),;
LoadBitmap( GetResources(), ::cBmpName ) )

if ::lAdjustBtn
nBmpWidth := nBmpWidth( hBitmap ) + 5
::SetMargins( 1, nBmpWidth )
else
nBmpWidth := ::nHeight - 5
endif

if ::lBtnTransparent
::oBtn := TBtnBmp():New(-1, ::nWidth - nBmpWidth - 3, nBmpWidth, ::nHeight - 3,;
if ( !lFileBmp, ::cBmpName, ),,if ( lFileBmp, ::cBmpName, ),,{|| (Eval( oThis:bAction, oThis ), oThis:SetFocus()) },;
Self,,,,,,,,,.f.)
::oBtn:lTransparent := ::lBtnTransparent
else
::oBtn := TButtonBmp():New(-1, ::nWidth - nBmpWidth - 3, , Self, {|| (Eval( oThis:bAction, oThis ), oThis:SetFocus()) }, ;
nBmpWidth, ::nHeight - 3,,,,.t.,,,,,,,::cBmpName )
endif

DeleteObject( hBitmap )

endif
::oBtn:lCancel = .T. // .T. so the GET VALID is not fired when the button is focused

if Upper( ::oWnd:ClassName() ) == "TDIALOG" .and. ::oWnd:lResize16
::oBtn:nWidth = ::nHeight - 5
::oBtn:nHeight = ::nHeight - 2
::oBtn:nLeft = ( ::nWidth * 1.167 ) - ::nHeight+iif(::nWidth>200,1,2) // By Dutch
endif


/*
// We force a WM_NCCALCSIZE msg to be sent to the GET
SetWindowPos( ::hWnd, 0, 0, 0, 0, 0,;
nOr( SWP_NOMOVE, SWP_NOSIZE, SWP_NOZORDER, SWP_FRAMECHANGED ) )
*/
endif

return nil

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

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