Hola colegas necesito cambiar el nombre a los botones de SI y NO de MsgYesNo,, y poder cambiarlo a otro nombre a los botones
saludos
Cambiar MsgYesNo
- Antonio Linares
- Site Admin
- Posts: 42259
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Cambiar MsgYesNo
La solución es crear una caja de diálogo en donde tienes el 100% de control
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Cambiar MsgYesNo
jbrita wrote:Hola colegas necesito cambiar el nombre a los botones de SI y NO de MsgYesNo,, y poder cambiarlo a otro nombre a los botones
saludos
Code: Select all | Expand
#include "fivewin.ch"
#define W_BTN 43
#define H_BTN 11
Function Main()
IF Msg_YesNoUsr()
msginfo("Si")
else
msginfo("No")
endif
return nil
Function Msg_YesNoUsr(cTitle, cText, cTBtn, cFBtn, lShort)
local oDlg, oFont
local lResult := .F.
local nDlgLen := 107, nTxtLen := 40, nBtnRow := 39
default cTitle := "User Input Requested", ;
cText := "Select one:", ;
cTBtn := "OK", ;
cFBtn := "Cancel", ;
lShort := .F.
if lShort
nDlgLen := 68
nTxtLen := 16
nBtnRow := 20
endif
define font oFont name "MS Sans Serif" size 0, -8 bold
define dialog oDlg from 1, 1 to nDlgLen, 336 title cTitle pixel font oFont
@ 3, 3 say cText centered ;
size 162, nTxtLen pixel of oDlg font oFont
@ nBtnRow, 5 button cTBtn ;
size W_BTN, H_BTN pixel of oDlg font oFont ;
action (lResult := .T., oDlg:End()) ;
default
@ nBtnRow, 61 button cFBtn ;
size W_BTN, H_BTN pixel of oDlg font oFont ;
action oDlg:End()
@ nBtnRow, 117 button "&Help" ;
size W_BTN, H_BTN pixel of oDlg font oFont ;
action ShowHelp()
activate dialog oDlg centered
oFont:End()
SysRefresh()
Return(lResult)
Function ShowHelp(cTopic)
/*
Will show the current help topic unless a topic is given, then that will
be shown. If no default help file has been defined, you will get a message
indicating this.
*/
if empty(GetHelpFile())
MsgInfo("No help file defined", "Help")
else
default cTopic := GetHelpTopic()
if empty(cTopic)
HelpIndex()
else
HelpTopic(cTopic)
endif
endif
Return(NIL)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Re: Cambiar MsgYesNo
Investigando, un poco, se podría usar TaskDialog del API de Windows (ChatGPT), y pasandolo a Harbour:
Y se puede usar de esta forma:
Saludos.
Carlos.
Code: Select all | Expand
#pragma BEGINDUMP
#include <Windows.h>
#include <CommCtrl.h>
#include <hbapi.h>
static WCHAR* AnsiToWide(const char* str) {
int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
WCHAR* wstr = (WCHAR*)malloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, str, -1, wstr, len);
return wstr;
}
//------------------------------------------------------------------------------------------
HB_FUNC( TSMSGYESNO )
{
TASKDIALOGCONFIG config;
TASKDIALOG_BUTTON buttons[2];
int selectedButton = 0;
HRESULT hr;
WCHAR *wMessage, *wTitle, *wBtnYes, *wBtnNo;
// Convertimos los strings a Unicode
wMessage = AnsiToWide(hb_parc(1));
wTitle = AnsiToWide(hb_parc(2));
wBtnYes = AnsiToWide(hb_parc(3));
wBtnNo = AnsiToWide(hb_parc(4));
// Configuramos el diálogo
memset(&config, 0, sizeof(TASKDIALOGCONFIG));
config.cbSize = sizeof(TASKDIALOGCONFIG);
config.hwndParent = NULL;
config.dwFlags = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS;
config.dwCommonButtons = 0;
config.pszWindowTitle = wTitle;
//config.pszMainIcon = TD_WARNING_ICON; ERROR // Icono de pregunta
config.pszMainIcon = TD_INFORMATION_ICON; // Icono de pregunta
config.pszMainInstruction = wMessage;
// Configuramos los botones
buttons[0].nButtonID = IDYES;
buttons[0].pszButtonText = wBtnYes;
buttons[1].nButtonID = IDNO;
buttons[1].pszButtonText = wBtnNo;
config.pButtons = buttons;
config.cButtons = 2;
config.nDefaultButton = IDYES; // Botón No como predeterminado
hr = TaskDialogIndirect(&config, &selectedButton, NULL, NULL);
// Liberamos la memoria
free(wMessage);
free(wTitle);
free(wBtnYes);
free(wBtnNo);
if (SUCCEEDED(hr)) {
hb_retl(selectedButton == IDYES);
} else {
hb_retl(HB_FALSE);
}
}
//------------------------------------------------------------------------------------------
HB_FUNC( TSMSGNOYES )
{
TASKDIALOGCONFIG config;
TASKDIALOG_BUTTON buttons[2];
int selectedButton = 0;
HRESULT hr;
WCHAR *wMessage, *wTitle, *wBtnYes, *wBtnNo;
// Convertimos los strings a Unicode
wMessage = AnsiToWide(hb_parc(1));
wTitle = AnsiToWide(hb_parc(2));
wBtnYes = AnsiToWide(hb_parc(3));
wBtnNo = AnsiToWide(hb_parc(4));
// Configuramos el diálogo
memset(&config, 0, sizeof(TASKDIALOGCONFIG));
config.cbSize = sizeof(TASKDIALOGCONFIG);
config.hwndParent = NULL;
config.dwFlags = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS;
config.dwCommonButtons = 0;
config.pszWindowTitle = wTitle;
//config.pszMainIcon = TD_WARNING_ICON; ERROR // Icono de pregunta
config.pszMainIcon = TD_INFORMATION_ICON; // Icono de pregunta
config.pszMainInstruction = wMessage;
// Configuramos los botones
buttons[0].nButtonID = IDYES;
buttons[0].pszButtonText = wBtnYes;
buttons[1].nButtonID = IDNO;
buttons[1].pszButtonText = wBtnNo;
config.pButtons = buttons;
config.cButtons = 2;
config.nDefaultButton = IDNO; // Botón No como predeterminado
hr = TaskDialogIndirect(&config, &selectedButton, NULL, NULL);
// Liberamos la memoria
free(wMessage);
free(wTitle);
free(wBtnYes);
free(wBtnNo);
if (SUCCEEDED(hr)) {
hb_retl(selectedButton == IDYES);
} else {
hb_retl(HB_FALSE);
}
}
#pragma ENDDUMP
Code: Select all | Expand
If tsMsgyesno("Desea ingresar al Sistema", ;
"Confirme por favor", ;
"Aceptar", ;
"Cancelar")
? "Aceptar"
Else
? "Cancelar"
EndIf
Carlos.
Re: Cambiar MsgYesNo
Prueba,
Regards, saludos.
Code: Select all | Expand
#include "FiveWin.ch"
FUNCTION Main()
LOCAL nOption, cMSG, cTIT
cMSG := "Message del Alert"
cTIT := "Title del Alert "
nOption := ALERT( cMSG, { 'Prodecer', 'Retornar' }, cTIT, 2, "AVISO" )
// MsgInfo( nOption ) // 1/2
IF( nOption ) = 1 // Proceder
Proceder()
ENDIF
RETURN NIL
FUNCTION Proceder()
? [Proceder]
RETURN NIL
// FIN / END
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Cambiar MsgYesNo
ThanksInvestigando, un poco, se podría usar TaskDialog del API de Windows (ChatGPT), y pasandolo a Harbour:
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Cambiar MsgYesNo
Muchisimas Gracias
Saludos
Saludos