📄 inputdlg.c
字号:
mxCreateString("Cancel"),
mxCreateString("Callback"),
CBString,
mxCreateString("Tag"),
mxCreateString("Cancel"),
NULL));
/*
* BtnInfo , ...
* 'Position' ,[ DefOffset DefOffset ...
* BtnWidth BtnHeight ...
* ] , ...
* 'String' ,'Cancel' , ...
* 'Callback' ,CBString , ...
* 'Tag' ,'Cancel' ...
* );
*
*
* CBString='set(gcbf,''UserData'',''OK'');uiresume';
*/
mlfAssign(&CBString, mxCreateString("set(gcbf,'UserData','OK');uiresume"));
/*
*
* OKHandle=uicontrol(InputFig , ...
*/
mlfAssign(
&OKHandle,
mlfNUicontrol(
1,
InputFig,
BtnInfo,
mxCreateString("Position"),
mlfHorzcat(
mlfMinus(mlfMinus(FigWidth, BtnWidth), DefOffset),
DefOffset,
BtnWidth,
BtnHeight,
NULL),
mxCreateString("String"),
mxCreateString("OK"),
mxCreateString("Callback"),
CBString,
mxCreateString("Tag"),
mxCreateString("OK"),
NULL));
/*
* BtnInfo , ...
* 'Position' ,[ FigWidth-BtnWidth-DefOffset DefOffset ...
* BtnWidth BtnHeight ...
* ] , ...
* 'String' ,'OK' , ...
* 'Callback' ,CBString , ...
* 'Tag' ,'OK' ...
* );
*
* Data.OKHandle = OKHandle;
*/
mlfIndexAssign(&Data, ".OKHandle", OKHandle);
/*
* Data.CancelHandle = CancelHandle;
*/
mlfIndexAssign(&Data, ".CancelHandle", CancelHandle);
/*
* Data.EditHandles = EditHandle;
*/
mlfIndexAssign(&Data, ".EditHandles", EditHandle);
/*
* Data.QuestHandles = QuestHandle;
*/
mlfIndexAssign(&Data, ".QuestHandles", QuestHandle);
/*
* Data.LineInfo = NumLines;
*/
mlfIndexAssign(&Data, ".LineInfo", NumLines);
/*
* Data.ButtonWidth = BtnWidth;
*/
mlfIndexAssign(&Data, ".ButtonWidth", BtnWidth);
/*
* Data.ButtonHeight = BtnHeight;
*/
mlfIndexAssign(&Data, ".ButtonHeight", BtnHeight);
/*
* Data.EditHeight = TxtHeight+4;
*/
mlfIndexAssign(&Data, ".EditHeight", mlfPlus(TxtHeight, mlfScalar(4.0)));
/*
* Data.Offset = DefOffset;
*/
mlfIndexAssign(&Data, ".Offset", DefOffset);
/*
* set(InputFig ,'Visible','on','UserData',Data);
*/
mclAssignAns(
&ans,
mlfNSet(
0,
InputFig,
mxCreateString("Visible"),
mxCreateString("on"),
mxCreateString("UserData"),
Data,
NULL));
/*
* % This drawnow is a hack to work around a bug
* drawnow
*/
mlfDrawnow(NULL);
/*
* set(findall(InputFig),'Units','normalized','HandleVisibility','callback');
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfFindall(InputFig, NULL),
mxCreateString("Units"),
mxCreateString("normalized"),
mxCreateString("HandleVisibility"),
mxCreateString("callback"),
NULL));
/*
* set(InputFig,'Units','points')
*/
mclPrintAns(
&ans,
mlfNSet(
0, InputFig, mxCreateString("Units"), mxCreateString("points"), NULL));
/*
* uiwait(InputFig);
*/
mlfUiwait(InputFig);
/*
*
* TempHide=get(0,'ShowHiddenHandles');
*/
mlfAssign(
&TempHide,
mlfGet(mlfScalar(0.0), mxCreateString("ShowHiddenHandles"), NULL));
/*
* set(0,'ShowHiddenHandles','on');
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfScalar(0.0),
mxCreateString("ShowHiddenHandles"),
mxCreateString("on"),
NULL));
/*
*
* if any(get(0,'Children')==InputFig),
*/
if (mlfTobool(
mlfAny(
mlfEq(
mlfGet(mlfScalar(0.0), mxCreateString("Children"), NULL),
InputFig),
NULL))) {
/*
* Answer={};
*/
mlfAssign(&Answer, mclCreateEmptyCell());
/*
* if strcmp(get(InputFig,'UserData'),'OK'),
*/
if (mlfTobool(
mlfStrcmp(
mlfGet(InputFig, mxCreateString("UserData"), NULL),
mxCreateString("OK")))) {
/*
* Answer=cell(NumQuest,1);
*/
mlfAssign(&Answer, mlfCell(NumQuest, mlfScalar(1.0), NULL));
/*
* for lp=1:NumQuest,
*/
for (mclForStart(&iterator_0, mlfScalar(1.0), NumQuest, NULL);
mclForNext(&iterator_0, &lp);
) {
/*
* Answer(lp)=get(EditHandle(lp),{'String'});
*/
mlfIndexAssign(
&Answer,
"(?)",
lp,
mlfGet(
mlfIndexRef(EditHandle, "(?)", lp),
mlfCellhcat(mxCreateString("String"), NULL),
NULL));
/*
* end % for
*/
}
/*
* end % if strcmp
*/
}
/*
* delete(InputFig);
*/
mlfDelete(InputFig, NULL);
/*
* else,
*/
} else {
/*
* Answer={};
*/
mlfAssign(&Answer, mclCreateEmptyCell());
/*
* end % if any
*/
}
/*
*
* set(0,'ShowHiddenHandles',TempHide);
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfScalar(0.0),
mxCreateString("ShowHiddenHandles"),
TempHide,
NULL));
/*
*
*
*/
return_:
mclValidateOutputs("inputdlg", 1, nargout_, &Answer);
mxDestroyArray(AxesHandle);
mxDestroyArray(Black);
mxDestroyArray(BtnFontSize);
mxDestroyArray(BtnHeight);
mxDestroyArray(BtnInfo);
mxDestroyArray(BtnWidth);
mxDestroyArray(BtnYOffset);
mxDestroyArray(CBString);
mxDestroyArray(CancelHandle);
mxDestroyArray(Data);
mxDestroyArray(DefAns);
mxDestroyArray(DefBtnWidth);
mxDestroyArray(DefOffset);
mxDestroyArray(EdInfo);
mxDestroyArray(EditHandle);
mxDestroyArray(EditHeight);
mxDestroyArray(EditTag);
mxDestroyArray(EditYOffset);
mxDestroyArray(ExtControl);
mxDestroyArray(ExtLp);
mxDestroyArray(Extent);
mxDestroyArray(FigColor);
mxDestroyArray(FigHeight);
mxDestroyArray(FigPos);
mxDestroyArray(FigWidth);
mxDestroyArray(InputFig);
mxDestroyArray(Interpreter);
mxDestroyArray(LightGray);
mxDestroyArray(LightGray2);
mxDestroyArray(MediumGray);
mxDestroyArray(NewPos);
mxDestroyArray(NewPos1);
mxDestroyArray(NumLines);
mxDestroyArray(NumQuest);
mxDestroyArray(OKHandle);
mxDestroyArray(OneVect);
mxDestroyArray(Prompt);
mxDestroyArray(QuestHandle);
mxDestroyArray(QuestHeight);
mxDestroyArray(QuestPos);
mxDestroyArray(QuestTag);
mxDestroyArray(QuestYOffset);
mxDestroyArray(Resize);
mxDestroyArray(ScreenSize);
mxDestroyArray(SmallOffset);
mxDestroyArray(StInfo);
mxDestroyArray(Temp);
mxDestroyArray(TempHide);
mxDestroyArray(TextInfo);
mxDestroyArray(Title);
mxDestroyArray(TxtBackClr);
mxDestroyArray(TxtForeClr);
mxDestroyArray(TxtHeight);
mxDestroyArray(TxtWidth);
mxDestroyArray(TxtXOffset);
mxDestroyArray(White);
mxDestroyArray(WindowStyle);
mxDestroyArray(WrapQuest);
mxDestroyArray(YOffLp);
mxDestroyArray(ans);
mxDestroyArray(cl);
mxDestroyArray(lp);
mxDestroyArray(nargin_);
mxDestroyArray(nargout);
mxDestroyArray(rw);
return Answer;
}
/*
* The function "mlfNInputdlg" contains the nargout interface for the
* "inputdlg" M-function from file
* "C:\MATLABR11\toolbox\matlab\uitools\inputdlg.m" (lines 1-363). This
* interface is only produced if the M-function uses the special variable
* "nargout". The nargout interface allows the number of requested outputs to
* be specified via the nargout argument, as opposed to the normal interface
* which dynamically calculates the number of outputs based on the number of
* non-NULL inputs it receives. This function processes any input arguments and
* passes them to the implementation version of the function, appearing above.
*/
mxArray * mlfNInputdlg(int nargout,
mxArray * Prompt,
mxArray * Title,
mxArray * NumLines,
mxArray * DefAns,
mxArray * Resize) {
mxArray * Answer = mclGetUninitializedArray();
mlfEnterNewContext(0, 5, Prompt, Title, NumLines, DefAns, Resize);
Answer = Minputdlg(nargout, Prompt, Title, NumLines, DefAns, Resize);
mlfRestorePreviousContext(0, 5, Prompt, Title, NumLines, DefAns, Resize);
return mlfReturnValue(Answer);
}
/*
* The function "mlfInputdlg" contains the normal interface for the "inputdlg"
* M-function from file "C:\MATLABR11\toolbox\matlab\uitools\inputdlg.m" (lines
* 1-363). This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
mxArray * mlfInputdlg(mxArray * Prompt,
mxArray * Title,
mxArray * NumLines,
mxArray * DefAns,
mxArray * Resize) {
int nargout = 1;
mxArray * Answer = mclGetUninitializedArray();
mlfEnterNewContext(0, 5, Prompt, Title, NumLines, DefAns, Resize);
Answer = Minputdlg(nargout, Prompt, Title, NumLines, DefAns, Resize);
mlfRestorePreviousContext(0, 5, Prompt, Title, NumLines, DefAns, Resize);
return mlfReturnValue(Answer);
}
/*
* The function "mlfVInputdlg" contains the void interface for the "inputdlg"
* M-function from file "C:\MATLABR11\toolbox\matlab\uitools\inputdlg.m" (lines
* 1-363). The void interface is only produced if the M-function uses the
* special variable "nargout", and has at least one output. The void interface
* function specifies zero output arguments to the implementation version of
* the function, and in the event that the implementation version still returns
* an output (which, in MATLAB, would be assigned to the "ans" variable), it
* deallocates the output. This function processes any input arguments and
* passes them to the implementation version of the function, appearing above.
*/
void mlfVInputdlg(mxArray * Prompt,
mxArray * Title,
mxArray * NumLines,
mxArray * DefAns,
mxArray * Resize) {
mxArray * Answer = mclUnassigned();
mlfEnterNewContext(0, 5, Prompt, Title, NumLines, DefAns, Resize);
Answer = Minputdlg(0, Prompt, Title, NumLines, DefAns, Resize);
mlfRestorePreviousContext(0, 5, Prompt, Title, NumLines, DefAns, Resize);
mxDestroyArray(Answer);
}
/*
* The function "mlxInputdlg" contains the feval interface for the "inputdlg"
* M-function from file "C:\MATLABR11\toolbox\matlab\uitools\inputdlg.m" (lines
* 1-363). The feval function calls the implementation version of inputdlg
* through this function. This function processes any input arguments and
* passes them to the implementation version of the function, appearing above.
*/
void mlxInputdlg(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[5];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: inputdlg Line: 1 Column:"
" 0 The function \"inputdlg\" was called with m"
"ore than the declared number of outputs (1)"));
}
if (nrhs > 5) {
mlfError(
mxCreateString(
"Run-time Error: File: inputdlg Line: 1 Column:"
" 0 The function \"inputdlg\" was called with m"
"ore than the declared number of inputs (5)"));
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 5 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 5; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 5, mprhs[0], mprhs[1], mprhs[2], mprhs[3], mprhs[4]);
mplhs[0]
= Minputdlg(nlhs, mprhs[0], mprhs[1], mprhs[2], mprhs[3], mprhs[4]);
mlfRestorePreviousContext(
0, 5, mprhs[0], mprhs[1], mprhs[2], mprhs[3], mprhs[4]);
plhs[0] = mplhs[0];
}
/*
* The function "Minputdlg_LocalResizeFcn" is the implementation version of the
* "inputdlg/LocalResizeFcn" M-function from file
* "C:\MATLABR11\toolbox\matlab\uitools\inputdlg.m" (lines 363-441). It
* contains the actual compiled code for that M-function. It is a static
* function and must only be called from one of the interface functions,
* appearing below.
*/
/*
* function LocalResizeFcn(FigHandle)
*/
static void Minputdlg_LocalResizeFcn(mxArray * FigHandle) {
mxArray * CancelPos = mclGetUninitializedArray();
mxArray * CurPos = mclGetUninitializedArray();
mxArray * Data = mclGetUninitializedArray();
mxArray * FigHeight = mclGetUninitializedArray();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -