Re: [code] [textadept] ui.dialogs

From: Mitchell <m.att.foicica.com>
Date: Thu, 16 Jan 2014 21:00:20 -0500 (EST)

Hi Richard,

On Wed, 15 Jan 2014, Richard Philips wrote:

> [snip]
>
>> Yes this is not trivial to implement. It also begs some questions. Should
>> there be labels next to each inputbox? If so, how should the API declare
>> them? How should it return the values from all inputboxes?
>>
>
> A suggestion for the API:
>
> ui.dialogs.inputbox
>
> - if option |informative_text is 'not a table' (string), keep the current
> functionality
>
> - if option informative_text is a table, present a multiline functionality
> (if it is a table, the option text should be a table as well)
> return selected button or exit code, table with the input text

This was actually easier than I thought. Latest changes are in gtdialog hg
and should show up in tonight's nightly build of Textadept. For example:

   a, b = ui.dialogs.inputbox{informative_text={'msg','1:', '2:', '3:'},
                              text={'foo', 'bar', 'baz'}}
   for k, v in pairs(b) do print(k, v) end

   --> 1 foo
   --> 2 bar
   --> 3 baz

This works in both GTK and terminal versions.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 16 Jan 2014 - 21:00:20 EST

This archive was generated by hypermail 2.2.0 : Fri 17 Jan 2014 - 06:27:52 EST