Msq..se repete 2 vezes ....

Post Reply
User avatar
Ale SB
Posts: 248
Joined: Wed Jan 11, 2006 11:30 am
Location: Campo Grande-MS / Brasil

Msq..se repete 2 vezes ....

Post by Ale SB »

Este codigo..funciona perfect com FwH2.6...ja com FwH712, as msg..se repete 2 vezes antes de sair.

Code: Select all

#include "FiveWin.ch"

static oWnd

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

function Main()

   local oBar

   SET _3DLOOK ON

   DEFINE WINDOW oWnd TITLE "MDIChilds from resources" MDI

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar ACTION child() //( Child(), MsgInfo( oWnd:oWndClient:aWnd[ 1 ]:cCaption ) )

   ACTIVATE WINDOW oWnd maximized

return nil

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

function Child()

   local oWndChild, oDlg, oBtn, n
   local cName := "Testing..."

   DEFINE WINDOW oWndChild MDICHILD OF oWnd ;
      FROM 5,5 TO 6,6;
      COLOR "N/W"

   oWndChild:bGotFocus  = { || oDlg:SetFocus() }

   DEFINE DIALOG oDlg RESOURCE "Child1" OF oWndChild

   REDEFINE GET cName ID 110 OF oDlg

   REDEFINE BUTTON oBtn ID 120 OF oDlg ;
      ACTION ( MsgInfo( "First" ), oBtn:SetFocus() )


   REDEFINE BUTTON ID 130 OF oDlg ACTION MsgInfo( "Second" )

   for n = 1 to Len( oDlg:aControls )
      oDlg:aControls[ n ]:bLClicked = GenBlock( oWndChild, oDlg:aControls[ n ] )
   next 	 
   	
   ACTIVATE DIALOG oDlg NOWAIT ;  // It has to be NonModal --> NOWAIT clause
      ON INIT oDlg:Move( 0, 0 ) ;
        valid ( if(Salir(),;
                  (Eval( {|| oWndChild:End(), .T. }), .t. ),;
                  (.f.) ))

   // Correct window size to match dialog
   oWndChild:nWidth := oDlg:nWidth+7
   oWndChild:nHeight := oDlg:nHeight+32

   ACTIVATE WINDOW oWndChild ON INIT oWnd:paint()

return nil

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

function GenBlock( oWndChild, oControl )

return { || oWndChild:SetFocus(), oControl:SetFocus() }
	
//----------------------------------------------------------------------------//
Static Function Salir()
   Local iRet:= .f.

   iRet:= MsgYesNo("Abandona la opcion ?","Cerrar de Ventas")

RETURN iRet
Sendo q esta msg..deve aparecer una unica vez...

Es algum Bug, FwH712 ?

Saluds
aleseribeli@hotmail.com

FwH, Hb Svn, ADS 8.1, ADS 10, Pelles C, FwPPC, MsVc 2008, MsVc 2010
"Conhecimento, você não subtrai quando divide; mas soma e multiplica."
**---Mário Persona---**
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Ale,

Cual de los MsgInfo() ? ó es el MsgYesNo() ?

Puedes proporcionar el RC usado ? gracias
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Ale SB
Posts: 248
Joined: Wed Jan 11, 2006 11:30 am
Location: Campo Grande-MS / Brasil

Post by Ale SB »

El msgYesNo()

.RC

Code: Select all

child1 DIALOG 18, 18, 317, 189
STYLE WS_CHILD
{
 CONTROL "", -1, "static", SS_BLACKRECT | WS_CHILD | WS_VISIBLE, 7, 5, 107, 50
 EDITTEXT 110, 15, 10, 93, 12, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP
 PUSHBUTTON "Text", 120, 32, 35, 24, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 PUSHBUTTON "Text", 130, 67, 35, 24, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 CONTROL "", -1, "static", SS_BLACKRECT | WS_CHILD | WS_VISIBLE, 7, 59, 108, 20
 LTEXT "This is a resource !!!", -1, 25, 65, 68, 8
 CONTROL "Text", 111, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 85, 28, 12
}
aleseribeli@hotmail.com

FwH, Hb Svn, ADS 8.1, ADS 10, Pelles C, FwPPC, MsVc 2008, MsVc 2010
"Conhecimento, você não subtrai quando divide; mas soma e multiplica."
**---Mário Persona---**
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Ale,

Hazlo así:

Code: Select all

   ACTIVATE DIALOG oDlg NOWAIT ;  // It has to be NonModal --> NOWAIT clause 
      ON INIT oDlg:Move( 0, 0 ) ;
      VALID .F.
...
   ACTIVATE WINDOW oWndChild ON INIT oWnd:paint() ;
      VALID Salir()
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply