如何在c ++ builder中使用具有多个值的InputBox [英] how to use InputBox in c++builder with multiple values

查看:157
本文介绍了如何在c ++ builder中使用具有多个值的InputBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用InputBox使其具有3个值。我可以使用代码使它仅显示一个值:

How can I use InputBox to make it take 3 Values. I can make it show just one value by using code:

String input[3];
input[0]= InputBox("paied check", "the value", "");

有什么帮助吗?

推荐答案

InputBox()不支持您的要求。它仅适用于单值输入。

InputBox() does not support what you are asking for. It is designed for single-value input only.

InputQuery() 支持多值输入,但仅在C ++ Builder XE2和更高版本中支持,例如:

InputQuery() supports multi-value input, but only in C++Builder XE2 and later, eg:

String prompt[3] = {"value 1:", "value2:", "value 3:"};
String input[3];

if( InputQuery("paied check", EXISTINGARRAY(prompt), EXISTINGARRAY(input)) )
{
    //...
}

或:

String input[3];

if( InputQuery("paied check", OPENARRAY(String, ("value 1:", "value2:", "value 3:")), EXISTINGARRAY(input)) )
{
    //...
}

请注意 OPENARRAY() / EXISTINGARRAY()宏(来自 sysopen.h )。它们是必需的,因为 InputQuery()仅接受Delphi样式的开放数组,而不接受C样式的数组。 Open Arrays有一个附加参数(在Delphi中是隐藏的,但在C ++中是显式的),用于指定每个数组的最高索引(而不是数组计数)。宏可以为您处理这些额外的值,但它们仅适用于静态数组(您正在使用)。

Notice the use of the OPENARRAY()/EXISTINGARRAY() macros (from sysopen.h). They are needed because InputQuery() only accepts Delphi-style Open Arrays, not C-style arrays. Open Arrays have an additional parameter (that is hidden in Delp but is explicit in C++) to specify the highest index (not the array count) of each array. The macros handle that extra value for you, but they only work for static arrays (which you are using).

这篇关于如何在c ++ builder中使用具有多个值的InputBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆