Forum Discussion
mugheessiddiqui
13 years agoContributor
Hi Stephanie
Following function will return you the default button of Msgbox, I have only tested with
vbYesNo, I hope It will work for other configuration as well.
Note: use this funtion as you get a msgbox without Keying tab or transfer focus to other button.
function test5()
{
var def_but = Get_Default_Button(Aliases.Orders.dlgConfirm);
Log.Message(def_but.WndCaption);
}
function Get_Default_Button(dlg)
{
dlg.Activate();
var dic = dlg.FindAllChildren("WndClass", "Button", 5);
dic = (new VBArray(dic)).toArray();
for( i=0; i < dic.length; i++)
{
if((dic.WndStyles & Win32API.WS_BORDER == Win32API.WS_BORDER) == 1)
return dic;
}
}