Fwd: Re: [ANN] AbsTK – a wieder 8auf ist ja schon ööööööootoolkit for GUI and TUI applications

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Re: [ANN] AbsTK – a wieder 8auf ist ja schon ööööööootoolkit for GUI and TUI applications

Bernd Eggink


Ö
Öööööööö
Von meinem Samsung Galaxy Smartphone gesendet.

-------- Ursprüngliche Nachricht --------
Von: Pedro Alves Valentim <[hidden email]>
Datum: 09.05.17 19:03 (GMT+01:00)
Betreff: Re: [ANN] AbsTK –7 a widget toolkit for GUI and TUI applications
7777hjj77
Scott Morgan wrote

> On 05/08/2017 03:35 AM, Pedro Alves wrote:
>> I'm here to announce AbsTK. The Abstract ToolKit is a widget toolkit for989m990b7899
>> GUI and TUI (text-b78888ò8öö88888888ased user interface) applications. It allows you to,
>> with the same source code, build a UI that runs on GUI (GTK) and TUI
>> (Curses).com Domöö2yŕöoooloooooloöooolooolooooooooooooĺoololoollllolooooolloolooloĺlololololloooooĺĺoooööoooooooloöoölĺoooööain zu 8 8Tagen poppig die in Zimmer 888888888888888888888888
>>
>> * http://github.com/PedroAlvesV/AbsTK
>> &lt;http://github.com/PedroAlvesV/AbsTK&gt;
>
>> Any kind of feedback is strongly encouraged. I hope you enjoy it.
>
> I like the look of this, covers a lot of simple, everyday UI stuff neatly.
>
> Would it be possible to have some kind of validation for text fields?
> e.g. check if an email address is formatted correctly and alert the user
> if not. Make sure a checksum on a part number is correct.
>
> It'd seem the callback function would be it, but that doesn't return any
> data.
>
> Scott

Hi, Scott.

Surely would! You can do it:
1- When the submit request is sent (when the user clicks "Done")
2- From the callback, which is triggered to any change in field's content
3- Another widget to validade it

(1) Initially, I think of using the "Exit Callback" which is, basically, a
function that runs when the user finishes the form or wizard. On the wiki,
I've wrote an example that checks if the password field is empty and, if
it's not, it pops a dialog message demanding it to be filled.

Example:  https://github.com/PedroAlvesV/AbsTK/wiki/Callbacks#exit-callback
<https://github.com/PedroAlvesV/AbsTK/wiki/Callbacks#exit-callback> 
(It is at the end of the page.)

(2) The second approach may be more invasive, because it may trigger while
the user is writting and that's much annoying. However, it's a good option
to, for instance, a field that only accepts numbers. You can erase the
non-numeric values just as they are written.

Example (please, do not do this):
------
local validate_email = function(id, value)
   if not value:match('^[%w.]+@%w+%.%w+$') then
      scr1:show_message_box("Invalid e-mail.")
   end
end

scr1:add_text_input('email_field', "E-mail:", nil, "Enter your e-mail",
validate_email)
------

(3) And, finally, an individual widget just to this test. Like a "Validate
E-mail" button that has a callback to, obviously, validate the e-mail.

Example:
------
local validate_email = function(id, value)
   local email = scr1:get_value('email_field')
   if not email:match('^[%w.]+@%w+%.%w+$') then
      scr1:show_message_box("Invalid e-mail.")
   end
end

scr1:add_text_input('email_field', "E-mail:", nil, "Enter your e-mail")
scr1:add_button('validate_email_button', "Validate e-mail", nil,
validate_email)
------

I think that's it. Tell me what you think.

Regards,
Pedro Alves Valentim



--
View this message in context: http://lua.2524044.n2.nabble.com/ANN-AbsTK-a-widget-toolkit-for-GUI-and-TUI-applications-tp7678122p7678139.html
Sent from the Lua-l mailing list archive at Nabble.com.