askYesNo()

meik michalke meik.michalke at uni-duesseldorf.de
Wed May 16 21:45:36 UTC 2018


hi,

Am Mittwoch, 16. Mai 2018, 21:08:02 CEST schrieb Thomas Friedrichsmeier:
> On Wed, 16 May 2018 17:12:58 +0200
> meik michalke <meik.michalke at uni-duesseldorf.de> wrote:
> > that's an even better idea. i've pushed something for testing, i just
> > called the new function rk.askYesNo() and modelled its arguments
> > after askYesNo().
> 
> nice! Seems to work just fine. So with this, we can just do
> options("askYesNo"=rk.askYesNo), and that's it, right?

after some initial checks i'm afraid it's not so easy after all. there's some 
small issues like we'd have to rename the "message" argument into "msg" 
because askYesNo() is hardcoded to call the function with "msg = msg".

but the more complex thing is handling the "prompts" argument in a sane way. 
the thing is, if a user doesn't want to use "yes", "no" and "cancel", he will 
set "prompts" accordingly, thus removing the default getOption("askYesNo") 
from the askYesNo() call, which will effectively circumvent the use of 
rk.askYesNo() and alternatively pop up a text input window.

to also cover those cases, i guess we'll have to mask askYesNo() completely 
with our own function and have it also handle the set options accordingly. it 
is a relatively trivial function, so i'd not expect huge surprises here. our 
function could check if "prompts" is a function and call utils::askYesNo() 
with it if that's a positive -- that would again produce the text input popup, 
but we'll not be able to take care of custom functions here, will we.

shall i proceed?

> I suppose we may want to add a "..." parameter in front of caption,
> just to be on the safe side, in case askYesNo() gains further parameters
> in the future.

true, and if we're to replace the function with our own, we'll have to include 
that anyway.

> Could you also document the return value, explicitly, and mention that
> buttons can be hidden by supplying "" as their label?

sure.


viele grüße :: m.eik

-- 
  dipl. psych. meik michalke
  institut f"ur experimentelle psychologie
  abt. f"ur diagnostik und differentielle psychologie
  heinrich-heine-universit"at d-40204 d"usseldorf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20180516/51843102/attachment.sig>


More information about the rkward-devel mailing list