开发者

What's the best practice for sequential dialogs in Visual C++?

I have an application that has to calculate some numbers based on some input data. This data can either come from a file or can be entered manually (it's only 5-6 values). I want to present a dialog box that basically asks "Do you want to load data from file or enter it manually?". If "load" is selected, I want to present a file open dialog box, and then parse the selected file to extract the relevant data. If "manual" is selected I want to present a custom CDialog subclass where the user can enter the the same data that would have been extracted from a data file.

My primary question is what is considered the best practice for stringing this together?

Should I call the dialog boxes sequentially like this?

// pseudocode
void foo(){
    status = MessageBox("Do you want to enter data from file?");

    if (status == YES) {
        filename = CFileDialog();
        inputdata = processInputFile(filename);
    }
    else {
        CManualEntryDialog.doModal();
        inputdata = CManualEntryDialog.data;
    }

    // calculate output data from in开发者_如何学JAVAput data...
}

Or should I subclass CDialog and call CFileDialog & CManualEntryDialog from within that sublasses event handlers?


It seems that at least a significant fraction of your users will understand the numbers involved; they're not "magical". Therefore, it would make sense to show them after loading. You can nicely integrate this with the manual entry option.

Design one dialog with the 6 entry fields. Add a "Load" button that fills in these fields, but do not continue from there. This allows the user to verify and possibly modify these values. (Useful when he needs 4 out of the 5 values in the input file).

Do use a group box control around the 6 entry fields, with the Load/Ok/Cancel buttons outside. This makes it clear that the three buttons apply to the whole group.

The UX advantage of this approach is that it's more open to exploration. You don't force the user to choose up fron how to interact with your application. And with this level of complexity, it's unlikely to overwhelm your target audience.


For sequential dialogs, I would recommand a wizard process using the CPropertyPage and CPropertySheet classes.

Here is an example : http://www.dotnetheaven.com/Uploadfile/bulentozkir/pp_wizard04212005064904AM/pp_wizard.aspx

http://www.informit.com/library/content.aspx?b=Visual_C_PlusPlus&seqNum=79

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜