Tuesday, 15 January 2013

Multi-Query Dialog: multi query


Multi-Query Dialog: multi query

Syntax: multi query(label1, label2)
Example code:
appuifw.multi_query(u"First name:", u"Last name:")
This function displays a two-field text input dialog. The input parameters
label1 and label2 can be pre-defined by inserting Unicode strings.
NATIVE UI ELEMENTS – DIALOGS, MENUS AND SELECTION LISTS 37
The multi_query() function returns the values that the user inputs.
The values of the upper and lower input fields are jointly returned as a
tuple. In Python, a tuple is a comma-separated list of values, for example
(data1, data2). We learn more about handling tuples in Chapter 4. This
function, as with other dialogs, returns the empty value None if the user
cancels the dialog.
Exercise
To see how the multi-query dialog (Figure 3.3) appears on your phone,
create a script (shown as Example 4) that displays a multi-query dialog
that asks you to type your first name into the upper field and your last
name into the lower field. After typing your names and pressing the ‘OK’
button, a popup note should appear, displaying your full name.

No comments:

Post a Comment