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
// 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
#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
// 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"
*/
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
DEFINE DIALOG oDlg
ACTIVATE DIALOG oDlg;
VALID MYFUNC()
RETURN NIL
STATIC FUNCTION MYFUNC()
? "MYFUNC()"
RETURN .T.
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 43 guests