interceptar X de DIALOG

interceptar X de DIALOG

Postby mgsoft » Fri Apr 03, 2020 3:08 pm

Hola,

Me gustaría interceptar la X de un REDEFINE DIALOG para llamar a una función, pero no he visto el codeblock.

Muchas gracias por adelantado. Saludos
Saludos,

Eduardo
User avatar
mgsoft
 
Posts: 422
Joined: Mon Aug 17, 2009 12:18 pm
Location: España

Re: interceptar X de DIALOG

Postby ronaldo » Fri Apr 03, 2020 4:36 pm

ACTIVATE VALID()

OU

bValid
[b]Ronaldo Minacapelli[/b]
Sistemas, Hospedagem e Criação de WebSites
http://www.bazevani.com.br
User avatar
ronaldo
 
Posts: 139
Joined: Fri Nov 25, 2005 4:38 pm
Location: brasil

Re: interceptar X de DIALOG

Postby mgsoft » Fri Apr 03, 2020 5:43 pm

Muchas gracias, pero me temo que no funciona. Aquí he preparado un ejemplo:

Code: Select all  Expand view  RUN
// Our first DialogBox sample

#include "FiveWin.ch"


function main()

 local oWnd
  DEFINE WINDOW oWnd TITLE "Test " + FWVERSION from 1,1 to 600,600 pixel

  ACTIVATE WINDOW oWnd MAXIMIZED on init dlg()

return nil



function dlg()

   local oDlg, oIco, cTest := "Hello world!   "

   local nRet := .f.


   DEFINE ICON oIco FILE "..\icons\fivewin.ico"

   DEFINE DIALOG oDlg TITLE "I am a DialogBox" COLOR "W+/B" ;
      ICON oIco

   @ 1, 3 GET cTest


   @ 3, 5 BUTTON "&Ok" SIZE 40, 12 ;
      ACTION (MsgInfo( "Any action here!" ), oDlg:End()) DEFAULT

   @ 3, 16 BUTTON "&Cancel" SIZE 40, 12 ACTION ( XBROWSE(ODLG), oDlg:End())


   oDlg:bValid := {|| msginfo("AA"), oDlg:end(), .f. }

   ACTIVATE DIALOG oDlg CENTERED

?nret


return nil
Saludos,

Eduardo
User avatar
mgsoft
 
Posts: 422
Joined: Mon Aug 17, 2009 12:18 pm
Location: España

Re: interceptar X de DIALOG

Postby karinha » Fri Apr 03, 2020 6:17 pm

Code: Select all  Expand view  RUN

#include "FiveWin.ch"

STATIC oWnd, lSalida := .F.

FUNCTION Main()

   DEFINE WINDOW oWnd TITLE "Test " + FWVERSION from 1,1 to 600,600 pixel

   ACTIVATE WINDOW oWnd MAXIMIZED ON INIT( Dlg_Salida() )

   oWnd:End()

RETURN NIL

FUNCTION Dlg_Salida()

   local oDlg, oIco, cTest := "Hello world!   "

   DEFINE ICON oIco FILE "..\icons\fivewin.ico"

   DEFINE DIALOG oDlg TITLE "I am a DialogBox" COLOR "W+/B" ;
      ICON oIco

   @ 1, 3 GET cTest

   @ 3, 5 BUTTON "&Ok" SIZE 40, 12 ;
      ACTION( lSalida := .T., oDlg:End() ) DEFAULT

   @ 3, 16 BUTTON "&Cancel" SIZE 40, 12 ;
      ACTION ( lSalida := .F., oDlg:End() ) CANCEL

   ACTIVATE DIALOG oDlg CENTERED VALID( lSalida )

   lSalida := .F.

RETURN NIL
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7846
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: interceptar X de DIALOG

Postby mgsoft » Fri Apr 03, 2020 6:34 pm

Muchas gracias, pero no me sirve, porque al pinchar en la x antes de cerrar el diálogo, o incluso después, tengo que llamar a una función.
Saludos,

Eduardo
User avatar
mgsoft
 
Posts: 422
Joined: Mon Aug 17, 2009 12:18 pm
Location: España

Re: interceptar X de DIALOG

Postby karinha » Fri Apr 03, 2020 6:37 pm

Usas Resource?
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7846
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: interceptar X de DIALOG

Postby karinha » Fri Apr 03, 2020 7:04 pm

Usando Recurso/Resource:

Code: Select all  Expand view  RUN

// TESTE.PRG

#include "fivewin.ch"

FUNCTION main()

   LOCAL oWnd
   LOCAL oMenu
   
   MENU oMenu

   // MenuItem "From Code" action FromCode( oWnd )

   MenuItem "From Resource" action FromrES( oWnd )

   endmenu

   define window oWnd title "Test Button Get Transparent" MENU oMenu pixel
   
   activate window oWnd MAXIMIZED
 
   RETURN oWnd

FUNCTION FromRes( oWnd )

   LOCAL oDlg
   LOCAL oGet1, oGet2, oGet3, oGet4
   LOCAL cVar1, cVar2, cVar3, cVar4
   LOCAL lActive := .F., oSalida
   
   cVar1 := 0
   cVar2 := 0
   cVar3 := 0
   cVar4 := 0
   
   define dialog oDlg resource "fromres" of oWnd

   redefine GET oGet1 var cVar1 id 100 bitmap "on" action( msginfo( "With Transparent" ) ) of oDlg

   redefine GET oGet2 var cVar2 id 101 bitmap "on" action( msginfo( "Without Transparent" ) ) of oDlg

   redefine GET oGet3 var cVar3 id 102 bitmap "chkyes" action( msginfo( "With Adjust-Transparent" ) );
      COLOR CLR_BLACK, CLR_CYAN of oDlg

   redefine GET oGet4 var cVar4 id 103 bitmap "chkyes" ;
      action( if( lActive,oGet3:disable(),oGet3:enable() ), lActive := !lActive, oDlg:update() ) of oDlg
   
   oGet1:lBtnTransparent := .T.       // transparent button get oGet1
   
   oGet3:disable()
   oGet3:lBtnTransparent := .T.       // transparent button get oGet3
   oGet3:lAdjustBtn      := .T.       // Button Get Adjust Witdh oGet3
   oGet3:lDisColors      := .F.       // Deactive disable color
   oGet3:nClrTextDis     := CLR_WHITE // Color text disable status
   oGet3:nClrPaneDis     := CLR_BLUE  // Color Pane disable status

   oGet4:lAdjustBtn := .T.

   REDEFINE BUTTON oSalida   ID 301   OF oDlg                                ;
            ACTION ( lActive := .T., oDlg:End() ) CANCEL
   
   activate dialog oDlg centered
 
RETURN nil

// TESTE.RC
/*
#ifndef __64__
  1 24 "winxp\WindowsXP.Manifest"
#endif

#ifdef __64__
  1 24 "winxp\WindowsXP.Manifest64"
#endif

FROMRES DIALOG 231, 77, 150, 150
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
{
 EDITTEXT 100, 11, 10, 80, 15, ES_AUTOHSCROLL
 EDITTEXT 101, 10, 40, 80, 15, ES_AUTOHSCROLL
 EDITTEXT 102, 9, 70, 129, 17, ES_AUTOHSCROLL
 EDITTEXT 103, 10, 100, 130, 14, ES_AUTOHSCROLL
 PUSHBUTTON "&Salida", 301, 50, 131, 50, 14
}

ON BITMAP "..\bitmaps\on.bmp"

CHKYES BITMAP "..\bitmaps\chkyes.bmp"
*/

 


Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7846
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: interceptar X de DIALOG

Postby mgsoft » Fri Apr 03, 2020 7:59 pm

Hola,

No me he explicado bien, necesito que al hacer click sobre la X del diálogo llamar a una función, como sucede si pinchamos en ?.

Gracias por intentarlo.
Saludos,

Eduardo
User avatar
mgsoft
 
Posts: 422
Joined: Mon Aug 17, 2009 12:18 pm
Location: España

Re: interceptar X de DIALOG

Postby Enrico Maria Giordano » Sat Apr 04, 2020 10:07 am

Intenta asì:

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    ACTIVATE DIALOG oDlg;
             VALID MYFUNC()

    RETURN NIL


STATIC FUNCTION MYFUNC()

    ? "MYFUNC()"

    RETURN .T.


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: interceptar X de DIALOG

Postby mgsoft » Sun Apr 05, 2020 11:14 am

¡Muchas gracias Enrico!
Saludos,

Eduardo
User avatar
mgsoft
 
Posts: 422
Joined: Mon Aug 17, 2009 12:18 pm
Location: España


Return to FiveWin para Harbour/xHarbour

Who is online

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