Open PragTob opened 9 years ago
I imagine that this could be implemented as a style of dialog windows :)
I can safely say some Shoes 3.2 folk would like to turn off the "Shoes Says" or replace it with their own phrase.
I think turning it off through an option might be a good first step. Maybe default, but that would lose some shoeesiness - I dunno :)
Also it's cousin "Shoes asks". My preference would be a way to replace the phrase (they are C level app global *char).
May I propose :
alert("this is an alert")
alert("Your consciousness", "this is an alert")
alert("this is an alert", :notitle => true)
With one argument it would behave as normal in Shoes 3. - "Shoes says this is an alert" With two arguments it would produce "Your consciousness, this is an alert" If the second arg is :notittle => true it would produce "this is an alert"
Is this something that Shoes 4 can accept or do you have a suggestion that would work better for you?
This seems nice :-)
I'd propose to do it all with the options hash, like:
alert("some alert", title: "this is the title")
alert("some alert", title: :none) # could also be nil
# And for app level styling I'd propose using the `style` method to change it everywhere:
style Shoes::Ask, title: "the new app wide title"
@PragTob +1 for the options hash.
The consensus at Shoes 3.2 is we like
alert("some alert", title: nil) # or false
and we'll do the style Shoes::Ask
thing if its easy enough.
:+1: for the options hash with any falsey value for :title
turning it off entirely. Hopefully should be easy enough to accomplish for both dialog types in Shoes 4 (alert
is a built-in SWT thing, ask
is now a Shoes-based modal window).
I've tackled this a bit and found that the hash options are very easy to implement. In fact I've already got a solution and can send a PR. But about that style
thing, if I understand how style
works correctly there needs to be a separate class Shoes::Ask
, but as for now all dialog windows are implemented in Shoes::Dialog
. So maybe split Shoes::Dialog
into several classes? Which kinda looks 'meh' to me :)
@seethemhigh yes it'd need separate classes... it's kind of "meh" for something that is this similar in its current state but overall it is how shoes works currently, every separate thing has it's separate class. And if we want to have different options per class (one for confirm
, one for ask
for instance) - then I think there is hardly a way around it. Open for options and suggestions, though :)
I think something similar is done with radio
vs check
. They both inherit from check_button
, but have different style_with
arrays. Since check
and radio
are so similar, check
ends up being no more than a declaration of unique attributes to style_with
.
I haven't looked carefully at Shoes::Dialog
, so this might not apply, but I thought I'd toss my two cents in that having separate classes doesn't have to be too much code. :)
For reference we are talking about this:
Shoes 3.2:
On Shoes 4, right now no such text is displayed:
We probably want to to introduce that and make it adjustable, though.
edit: issue came in through the mailing list: