Todd,

Please see below. I'm leaving this in the list because you raise questions of style.

On 08/06/2020 03:45, ToddAndMargo via perl6-users wrote:
On 2020-06-07 08:45, Richard Hainsworth wrote:

<snip>By directions, I mean the (English) definition of
what each variable does. What do the following do:

:buttons,
:Response,
:timer,
:title,
:show-countdown,
data.response = <$data.response>;
etc.

They may be somewhere there, but I need a link
to them

In the example I gave in my README file (which I copied to a separate file and it runs as expected), I gave a way in which each argument is used. Also the names of the arguments are intended to be self-explanatory.

So buttons is about 'buttons', title is about the title, etc.

When I download a new module, I want to see how to use it, I don't find long word explanations to be much use.


<snip>
print "data response is = < { $popup.response } >";

That has got me into trouble before.  I switched to
     print( "data = <" ~ $popup ~ ">\n" );
This will give you information about the object, as I explained in some detail before.
print( "data.response = <" ~ $data.response ~ ">\n" );
This is the same as putting {} into a "-enclosed string.

     data = <Informative::Informing<81196960>>
So here you get the contents of data, which is an object, and this is the short way Raku tells you about objects.
data.response = <Cancel>   # or OK

And here you get the data you want. When the box came up, you clicked on the 'Cancel' button. The Cancel button was associated with the

string 'Cancel'. Try some of the other buttons and you get other strings. That's why I put various forms of nonsense in the example, to induce the reader to try to get the strings.

Also note that you have not defined $data.

oops.

What is with the weird
    data = <Informative::Informing<81196960>>
$data holds an object of type Informing.


2) why do I have to have more than one button?
`:buttons( OK=>'OK Maybe' )` errors with

      Type check failed in binding to parameter
      '@buttons'; expected Positional but got Pair
      (:OK("OK Maybe"))

More than one button, possible!

But look at the error message. You have specified `OK => 'string'` which is the definition of a Pair, as the error message says.

But what is wanted is a Positional, as the error message says. An example of a Positional is an Array. So try this

`:buttons( [ :OK("OK Maybe") ] )

The [ ] creates an Array, which is a Positional.


In my example, I gave three Pairs separated by commas. That is interpreted by raku as a Sequence, which is also a Positional.

You could have written

:buttons(:OK("OK Maybe) , ) # note the trailing comma, which is essential here.

So it was the comma.  Hmmmm
To be honest, I find Sequences, Arrays, Slip et al the MOST frustrating part of Raku. There is a whole tutorial in the Documentation about them. Its worth reading several times. But I can see that the reason for the very fine differentiation in Raku between Sequences and Array gives the language much more flexibility.

There is no reason why an Array can only have one item. But in order to make things generic, there needs to be a way to have more than one.

I have array's all the tme with only one element.  Then add t them latter.  Raku does not seem to care.  So I am confused

So am I. What does 'Then add t them latter' mean in English? Do you mean 'Then add t to them later'? Why would you add 't'? Where would you add 't'?

<snip>

how do I turn it into something useful to me?


5) What is popup suppose to show?
Say what?

$popup.show(

It 'show's $popup again. I thought this was being intuitive. Do I really need to say " $popup.show() shows popup again."

I know that is what JAVA does all the time, and I get really irritated saying "Something something is something". But the paradigm of Raku is to be intuitive in the way programs are written.



6) why is it not dismissing after 5 seconds?
I don't understand this. I am not prescient - I cannot see what is happening on your screen with your setup. It works fine on my computer.

It just sits there on my screen.  You example works though.
You gave me a screenshot,

https://ibb.co/X3sVxBV

Do you see the 20 in white in the lower right of the box? That is a countdown number. When it goes to zero, the box disappears.

The box sits there for 20 seconds with the counter going down. If you can't see the counter, ....

I thought I was being clever in making the screen shot only just visible. If you didn't notice the countdown clock, then I was being too clever. I'll change it to red by default.

Here's an example.

https://ibb.co/C0x5P30

Note the responses in the terminal panel, eg. we have b2.

By the way, this is CommaIDE which is written by  Jonathan. It can be used on Windows.

https://ibb.co/b54K2Yn
https://ibb.co/vhFmT9L

This probably means I'll need to add a count-down color argument.



7) why is there no "show-countdown"?

There is! `:show-countdown` is named parameter to the method 'show', and an example is shown.

By default `:show-countdown` is True, so there is no need to set it if you want a countdown. If you dont want a count-down shown, then you need to set `:!show-countdown` , which in itself is a shortcut for `show-countdown(True)` . This was one of the examples.

I think I misunderstand what :show-countdown does.  I was thinking the pop up would have a time showing remain seconds
to dismiss.
Hope the new colors make things easier to understand.


Hope the Module could be of some use.

Oh I love it.  It will get a lot of use!

:-)

Thank you!

-T

Reply via email to