Example #1
0
void MCDebuggingGetTraceStack(MCExecContext& ctxt, MCStringRef& r_value)
{
	if (MCtracestackptr == nil)
	{
		r_value = (MCStringRef)MCValueRetain(kMCEmptyString);
		return;
	}

	MCAutoValueRef t_value;
	if (MCtracestackptr -> names(P_NAME, &t_value))
		if (ctxt.ConvertToString(*t_value, r_value))
		return;

	ctxt . Throw();
}
Example #2
0
extern "C" MC_DLLEXPORT_DEF MCStringRef MCWidgetExecPopupMenuAtLocation(MCStringRef p_menu, MCCanvasPointRef p_at)
{
    if (!MCWidgetEnsureCurrentWidget())
        return nil;
	
	MCButton *t_button;
	t_button = nil;
	
	t_button = (MCButton*)MCtemplatebutton->clone(True, OP_NONE, true);
	if (t_button == nil)
	{
		MCErrorThrowOutOfMemory();
		return nil;
	}
	
	MCPopupMenuHandler t_handler;
	
	MCExecContext ctxt;
	
	t_button->setmenuhandler(&t_handler);
	
	t_button->SetStyle(ctxt, F_MENU);
	t_button->SetMenuMode(ctxt, WM_POPUP);
	t_button->SetText(ctxt, p_menu);
	
	MCPoint t_at;
	MCPoint *t_at_ptr;
	t_at_ptr = nil;
	
	if (p_at != nil)
	{
		MCGPoint t_point;
		MCCanvasPointGetMCGPoint(p_at, t_point);
		
		t_at = MCGPointToMCPoint(MCWidgetMapPointToGlobal(MCcurrentwidget, t_point));
		t_at_ptr = &t_at;
	}
	
	MCInterfaceExecPopupButton(ctxt, t_button, t_at_ptr);
    
	while (t_button->menuisopen() && !MCquit)
	{
		MCU_resetprops(True);
		// MW-2011-09-08: [[ Redraw ]] Make sure we flush any updates.
		MCRedrawUpdateScreen();
		MCscreen->siguser();
		MCscreen->wait(REFRESH_INTERVAL, True, True);
	}
	
	t_button->SetVisible(ctxt, 0, false);
    MCerrorlock++;
    if (t_button->del(false))
        t_button->scheduledelete();
    MCerrorlock--;
    
	MCAutoStringRef t_string;
	
	if (t_handler.GetPick() != nil)
		ctxt.ConvertToString(t_handler.GetPick(), &t_string);
	
	return t_string.Take();
}