Main menu puzzle

72 messages Options
Embed this post
Permalink
1 2 3 4
Ken Apthorpe

Main menu puzzle

Reply Threaded More More options
Print post
Permalink
Hi anyone
 
SHORT VERSION (immediate problem)

Created my first menu, using menu builder and autoscript. Ungrouped to look at scripts.  File menu has Exit, divider and Quit (for Mac shift). Script is:

--The following menuPick handler was generated by the Menu Builder.
on menuPick pWhich
  switch pWhich
  case "Exit"
    --Insert script for Exit menu item here
    break
  case "Quit"
    --Insert script for Quit menu item here
    break
  end switch
end menuPick

After exploration to discover an Exit/Quit script, my script is:
on menuPick pWhich
  switch pWhich
  case "Exit"
  on "Exit" answer "Are you sure you want to exit?" with "Yes" or "OK"
     if it is "OK" then quit
end "Exit"
break
  case "Quit"
  on "Quit" answer "Are you sure you want to quit?" with "Cancel Quit" or "OK"
      if it is "OK" then quit
end "Quit"
break
  end switch
end menuPick

Error window says error, hint "on".



LONG VERSION (working example of newbie problem)

First question is what does pWhich mean?  Look in Rev Dictionary.  Not listed. Look under commands, parameters etc. Look in Scripters Scrapbook. Look in tutorial stacks I've downloaded.  Lots of pWhichs in scripts but no explanations. Try a Google search (desperate). Get a bunch of links to Perl programming.  

OK, forget pWhich for the present, I need an Exit script.  Here's an example under quit in Dict:
on getMeOuttaHere
    answer "Are you sure you want to quit?" with "No way" or "OK"
    if it is "OK" then quit
  end getMeOuttaHere

So, my script should be:
on menuPick pWhich
  switch pWhich
  case "Exit"--for Win
  on "Exit" answer "Do you really want to exit?" with "No" or "OK"
     if it is "OK" then quit
end "Exit"
break
  case "Quit" --for Mac
  on "Quit" answer "Do you really want to to quit?" with "No" or "OK"
      if it is "OK" then quit
end "Quit"
break
  end switch
end menuPick

But Errors says this script is wrong, and gives the Hint "on".  How can it be wrong if it's a script from Docs? Look up case and switch but those are no help either. Look up "on". Don't understand any of the explanation.

In any event, if it worked this script would seem to create a dialogue box with two buttons to choose from.  OK is handled, but the No button doesn't seem to be. So, it's not actually going to work anyway.  So it's not a very helpful example of a script IMHO.

Try elsewhere. Look at FirstStack pdf.... ah.. page 15 has a mouseUp script, but maybe I can adapt bits of it. Here goes:

on menuPick pWhich
  switch pWhich
  case Exit
  on "Exit" answer "Do you really want to Exit?" with "No" or "OK"
     if it is "OK" then
     quit
   else if it is "No" then
       pass menuPick --total guess here, could be pass pWhich or pass Exit or?
end Exit
break
  case Quit
  on "Quit" answer "Do you really want to Quit?" with "No" or "OK"
      if it is "OK" then
      quit
    else if it is "No" then
        pass menuPick
end Quit
break
  end switch
end menuPick

Error: Hint  on  Good try, but it doesn't pass go.  Hmmm I've been at this for about an hour now. But, no pain no gain.

Next try. Open the Revolution Scripting Conferences - Menus stack. Hmmm, it doesn't have a main menu. Funny. A tutorial on menus that doesn't have a main menu as an example. Click through.  Lots of button menus that use mouseUp handlers, but no main menus that use menuPick. Wait, here is a card with a demo Menu bar stack for a Mac menu. Great, it will have menuPick scripts I can look at.  Open this substack, switch to Edit tool, ungroup the menu, select File, open Script editor..... crikey..... this is an unscripted menu with no scripts at all.

Last try. Open the Managing menus stack. Uh oh..... it's about building on-the-fly menus. I just want a plain vanilla static menu. Maybe I can understand this tutorial about a year from now.

Private thoughts I'll make public.  I've now spent two hours trying to do the right thing by giving Rev a go, experimenting, hunting thru the Docs, looking at other people's stacks to see how they do it, and supposing that somehow this would lead me to an understanding of Transcript.

The only thing I've discovered is that the very popular "pWhich" seems to have failed to make it into the Dictionary.

I wonder why it seems so impossible for Rev to produce a tiny template stack with a working main menu, and working scripts that are fully commented.  By fully, I mean with plain english (not "english-like") definitions and explanations. This is the typical script example I see:

case "Exit"
    --Insert script for Exit menu item here
        --or the variation, Do stuff here...
    break

This is fine for the experienced, but not helpful comments for newbies who don't have a clue what to insert, or how to find the cause of an error.

I'm sure someone can point me at a working example. Pity it's been so hard to find a Rev one.

Ken
Ken Apthorpe

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
Well, as Charley Brown would say, Good grief. I had to laugh. I thought I'd spare you all this by setting up a child forum. If there had been some instructions about how a child forum works it might have worked.  No instructions, so it didn't.  Situation normal I guess.
Alex Tweedly

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
Ken Apthorpe wrote:

(I don't have a helpful working version, so can't include one here ....
but I can tell you where you started to go wrong ....)

>Hi anyone
>
>SHORT VERSION (immediate problem)
>
>Created my first menu, using menu builder and autoscript. Ungrouped to look
>at scripts.  File menu has Exit, divider and Quit (for Mac shift). Script
>is:
>
>--The following menuPick handler was generated by the Menu Builder.
>on menuPick pWhich
>  switch pWhich
>  case "Exit"
>    --Insert script for Exit menu item here
>    break
>  case "Quit"
>    --Insert script for Quit menu item here
>    break
>  end switch
>end menuPick
>
>After exploration to discover an Exit/Quit script, my script is:
>on menuPick pWhich
>  switch pWhich
>  case "Exit"
>  on "Exit" answer "Are you sure you want to exit?" with "Yes" or "OK"
>     if it is "OK" then quit
>end "Exit"
>break
>  case "Quit"
>  on "Quit" answer "Are you sure you want to quit?" with "Cancel Quit" or
>"OK"
>      if it is "OK" then quit
>end "Quit"
>break
>  end switch
>end menuPick
>
>  
>
You don't need (in fact, MUST NOT have) the   'end "Exit"', or 'end
"Quit"' lines in there. There is no 'end' statement after each part of
the switch structure.

So the 'end "Exit"' statement is being taken as an attempt to end the
handler - i.e. to match with the "on menuPick". That's why the error
hint is 'on'

>Error window says error, hint "on".
>
>
>  
>
This, and all subsequent errors, are variants of that.

A good hint is to use the TAB key in the editor, to get the script to be
automatically properly indented. This will help you check that the
various control structures are properly matching up - mismatching
if-then-else or switch-end switch  can lead to confusing error messages.

>LONG VERSION (working example of newbie problem)
>
>First question is what does pWhich mean?  
>
it's a parameter name - so it could have been anything.
It's a convention to start parameters names with 'p' to help you
remember that it is a parameter to the handler/function, and to name it
helpfully. So pWhich is the parameter telling you which menu has been
picked.

-- Alex.

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17/02/2006

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Alex Tweedly

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
Alex Tweedly wrote:

an incomplete answer. While I was right that the "end exit" was what was
leading directly to the error hint of 'on', I missed another problem in
your script.

> Ken Apthorpe wrote:
>
>> After exploration to discover an Exit/Quit script, my script is:
>> on menuPick pWhich
>>  switch pWhich
>>  case "Exit"
>>  on "Exit" answer "Are you sure you want to exit?" with "Yes" or "OK"
>>     if it is "OK" then quit
>> end "Exit"
>> break
>
You also don't need the 'on "Exit"' part. So this should be simply

on menuPick pWhich
    switch pWhich
        case "Exit"
            answer "Are you sure you want to exit?" with "Yes" or "OK"
            if it is "OK" then quit
            break
        case "Quit"
           answer ....
           if it is "OK" then ...
           break
    end switch
end menuPick


--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17/02/2006

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kay C Lan

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
On 2/18/06, Ken Apthorpe <[hidden email]> wrote:

>
>
> Hi anyone
>
> SHORT VERSION (immediate problem)
>
> Created my first menu, using menu builder and autoscript. Ungrouped to
> look
> at scripts.  File menu has Exit, divider and Quit (for Mac shift). Script
> is:
>
> --The following menuPick handler was generated by the Menu Builder.
> on menuPick pWhich
>   switch pWhich
>   case "Exit"
>     --Insert script for Exit menu item here
>     break
>   case "Quit"
>     --Insert script for Quit menu item here
>     break
>   end switch
> end menuPick
>
> After exploration to discover an Exit/Quit script, my script is:
> on menuPick pWhich
>   switch pWhich
>   case "Exit"
>   on "Exit" answer "Are you sure you want to exit?" with "Yes" or "OK"
>      if it is "OK" then quit
> end "Exit"
> break
>   case "Quit"
>   on "Quit" answer "Are you sure you want to quit?" with "Cancel Quit" or
> "OK"
>       if it is "OK" then quit
> end "Quit"
> break
>   end switch
> end menuPick
>
> Error window says error, hint "on".



on "Exit" answer "Are you sure you want to exit?" with "Yes" or "OK"

should be just:
 answer "Are you sure you want to exit?" with "Yes" or "OK"

the line - case "Exit" is basically saying on Exit.

>From here I guess you can figure out what is wrong with the on "Quit"
line:-)

pWhich is a paramater passed when you make a selection - it could easily be
pTheMenuSelectionImade, in the documents I think they use theMenuItem (I
typed 'on menuPick' into Preview's search field and found the info in half
an eye blink - I love these new docs) so it really doesn't matter what you
call it so long as you pass the same name into the 'switch' control
structure.

HTH
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Alex Tweedly

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
Ken Apthorpe wrote:

>Well, as Charley Brown would say, Good grief. I had to laugh. I thought I'd
>spare you all this by setting up a child forum. If there had been some
>instructions about how a child forum works it might have worked.  No
>instructions, so it didn't.  Situation normal I guess.
>  
>
I for one am glad you didn't set it up as a separate forum. This email
list is not "for experts" - it's for everyone.

Your question might seem simple - but the answers it gets may help more
other people than some of the esoteric discussions we sometimes get so
passionate about.

It's a fair bet that anyone who answers your question on here has
received help themselves in the past, and is only too glad to have a
chance to help someone else. Karma counts :-)

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17/02/2006

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Ken Apthorpe

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Alex Tweedly
Thanks Alex

I'll copy and paste that into my Rev tips file, so I remember it's a parameter name.  I still do not understand how pWhich can tell that I've picked a menu item like Quit (or Open, or anything else).  

So, how does a pWhich identify what's been picked?  (you see the dimensions of my ignorance).

Comment for Rev support:
I have to wonder why I had to go to a user forum and rely on helpful others to provide this information.  If it's a convention (ie something "everyone" knows, and follows) one can only wonder why it doesn't seem to appear in the Rev dictionary.  I did a fairly thorough search, and I supposed it might be a parameter (among other things), so I put in parameter as a search term and scrolled thru the list of parameters, and failed to find it.  If it is such a common convention, how come?
Answer: Everybody knows this...
Reply:  No, they don't.... but if you want Rev to be scripting for the rest of us, you'll have to make it a bit easier to find it out.

Thanks Alex.  As you can see, I have another agenda going here but I appreciate all the help I can get.  I need lots.

regards
Ken



Ken Apthorpe

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Kay C Lan
Kay

Thanks, but I don't get it:
<it could easily be pTheMenuSelectionImade, in the documents I think they use theMenuItem (I
typed 'on menuPick' into Preview's search field and found the info in half an eye blink>

Preview's search field?  I was in Rev, searching Rev docs and assorted third part stacks.  You were in Preview?  So you had a pdf file open?  Which one?

As for pTheMenuSelectionImade.....?  I saw nothing remotely like this in any of the sample scripts I could find.  I'm happy it worked for you.  Where can I find this script?

Regards
Ken


Ken Apthorpe

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Alex Tweedly
Alex
You say:
on menuPick pWhich
    switch pWhich
        case "Exit"
            answer "Are you sure you want to exit?" with "Yes" or "OK"
            if it is "OK" then quit
            break
        case "Quit"
           answer ....
           if it is "OK" then ...
           break
    end switch
end menuPick

I'm sure this would work.  Problem is, I don't understand why.  This isn't your problem, you've given me a solution which is more than I could expect, thank you.

My problem with this script is:  it produces two choices, Yes or No. Buttons I assume.  OK is handled.  Yes does not appear to be handled by anything.  But, if it works it must be handled somehow.  But there is nothing in this script (that I can see) to cater for a choice of Yes.

It's a dilemma.  You say this works. I believe you (on faith, not having tried it). But I can't see how it can possibly work, because there is nothing that appears to handle a choice of Yes.  Isn't programming supposed to follow the script?

Or... is there some mystical dimension to these scripts... some sort of default skypilot script or command that takes care of these messy details?  If so, does one have to enter an order for the secret to be revealed?

Regards
ken



Klaus Major

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
Hi Ken,

> Thanks Alex
>
> I'll copy and paste that into my Rev tips file, so I remember it's a
> parameter name.  I still do not understand how pWhich can tell that  
> I've
> picked a menu item like Quit (or Open, or anything else).
>
> So, how does a pWhich identify what's been picked?  (you see the  
> dimensions
> of my ignorance).

well that's the way the engine has been programmed :-)

The engine is always waiting in the background for something (an  
event) to happen,
Rev is an "event driven" application.

One of the events might be a simple mouseclick and even there it  
awaits a parameter
  -> the number of the mousebutton that has been clicked 1 = left  
mousebutton,
2 = middle mousebutton and 2 = right mousebutton) if "mouseup" does  
not come
with a parameter, the engine presume that it was a "normal" (= 1 =  
left) mouseclick.

Or the event might be a "menupick"!

  In this case the enigne knows that one parameter will "accompany"  
the message
"menupick" -> the actual name of the menu that the user has picked.

So "pWhich" is just a placeholder and could also be named "Ken" or  
even "Ethel_Merman",
that really does not matter, since it will be replace with the actual  
name... see above.

I hope these metaphores will clear things a bit :-)


There are many build-in events like mouseup,mousedown, opencard,  
openstack,
scrollbardrag etc... all of which might come with one or more  
parameters or not.

> ...
>
> regards
> Ken

Regards

Klaus Major
[hidden email]
http://www.major-k.de

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Klaus Major

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
Hi Ken,

> Alex
> You say:
> on menuPick pWhich
>     switch pWhich
>         case "Exit"
>             answer "Are you sure you want to exit?" with "Yes" or "OK"
>             if it is "OK" then quit
>             break
>     ...
> I'm sure this would work.  Problem is, I don't understand why.  
> This isn't
> your problem, you've given me a solution which is more than I could  
> expect,
> thank you.
>
> My problem with this script is:  it produces two choices, Yes or  
> No. Buttons
> I assume.  OK is handled.  Yes does not appear to be handled by  
> anything.
> But, if it works it must be handled somehow.  But there is nothing  
> in this
> script (that I can see) to cater for a choice of Yes.

See below, i am sure it should read "NO" instead of "YES"

> It's a dilemma.  You say this works. I believe you (on faith, not  
> having
> tried it). But I can't see how it can possibly work, because there is
> nothing that appears to handle a choice of Yes.  Isn't programming  
> supposed
> to follow the script?
>
> Or... is there some mystical dimension to these scripts... some  
> sort of
> default skypilot script or command that takes care of these messy  
> details?
> If so, does one have to enter an order for the secret to be revealed?

I think Alex meant this one:

> on menuPick pWhich
>     switch pWhich
>         case "Exit"
             answer "Are you sure you want to exit?" with "NO" or "OK"
## OK and YES are synonyms and that would not make sense here :-)

>             if it is "OK" then quit
>             break
>         case "Quit"
>            answer ....
>            if it is "OK" then ...
>            break
>     end switch
> end menuPick


>
> Regards
> ken

Best

Klaus Major
[hidden email]
http://www.major-k.de

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
masmit

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
When your user picks an item from a menu, the rev engine knows that  
this has happened. It also knows which item was chosen.

So it then sends a message "menuPick" to your menu button, to let it  
know that a choice has been made, and it puts the name of the chosen  
menuItem into a parameter which it sends along with the menuPick  
message. Your menu button must handle this message, and make use of  
the parameter. So your menu button needs to have a script containing  
an "on menuPick" handler. You then choose a name for the parameter,  
it could be "pWhich" or it could be "Dave". So:

on menuPick Dave
-- at this point, "Dave" is a variable containing the name of the  
menuItem that was chosen

   switch Dave
     -- you fill in your switch structure with whatever menuItems you  
put in your menu, and handle them as you wish
   end switch
end menuPick

Hope this helps,

Mark

On 18 Feb 2006, at 12:25, Ken Apthorpe wrote:

>
> Thanks Alex
>
> I'll copy and paste that into my Rev tips file, so I remember it's a
> parameter name.  I still do not understand how pWhich can tell that  
> I've
> picked a menu item like Quit (or Open, or anything else).
>
> So, how does a pWhich identify what's been picked?  (you see the  
> dimensions
> of my ignorance).
>
> Comment for Rev support:
> I have to wonder why I had to go to a user forum and rely on  
> helpful others
> to provide this information.  If it's a convention (ie something  
> "everyone"
> knows, and follows) one can only wonder why it doesn't seem to  
> appear in the
> Rev dictionary.  I did a fairly thorough search, and I supposed it  
> might be
> a parameter (among other things), so I put in parameter as a search  
> term and
> scrolled thru the list of parameters, and failed to find it.  If it  
> is such
> a common convention, how come?
> Answer: Everybody knows this...
> Reply:  No, they don't.... but if you want Rev to be scripting for  
> the rest
> of us, you'll have to make it a bit easier to find it out.
>
> Thanks Alex.  As you can see, I have another agenda going here but I
> appreciate all the help I can get.  I need lots.
>
> regards
> Ken
>
>
>
>
> --
> View this message in context: http://www.nabble.com/Main-menu- 
> puzzle-t1145446.html#a3004643
> Sent from the Rev Pilgrim's Progress forum at Nabble.com.
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Alex Tweedly

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
Ken Apthorpe wrote:

>Thanks Alex
>
>I'll copy and paste that into my Rev tips file, so I remember it's a
>parameter name.  I still do not understand how pWhich can tell that I've
>picked a menu item like Quit (or Open, or anything else).  
>
>So, how does a pWhich identify what's been picked?  (you see the dimensions
>of my ignorance).
>
>  
>
Handlers (and functions) can have parameters - which can be named
anything you like. If it's a built-in handler, then the documentation
will tell you what the parameters are. For instance, the docs for
menuPick say

> Sent to a button when a menu item is chosen from the menu associated
> with that button.
>
> menuPick chosenItem[|submenuName],previousTab
>
> on menuPick theItem -- in a pulldown menu
>   if theItem is "Close" then close the defaultStack
>   else if theItem is "Quit" then quit
> end menuPick
>
As you can see, this example uses "chosenItem" rather than "pWhich" as
the name for the first parameter. Further on in the docs, it describes
these parameters as

> Parameters:
> The chosenItem is the text of the menu item the user chose. If the
> menu item is part of a submenu, the menu item text is followed by a
> vertical bar (|) and the submenu's name.
>
> The previousTab is the text of the menu item that was selected before
> the user chose a new menu item. This parameter is included only if the
> button's menuMode property is set to "tabbed".
>
So we know that the first parameter contains the text of the menu item
chosen. You can therefore use it in an "if" condition (as in the docs
example) or in a switch statement (as the menuBuilder does), or any
other you might want.

>Comment for Rev support:
>I have to wonder why I had to go to a user forum and rely on helpful others
>to provide this information.  If it's a convention (ie something "everyone"
>knows, and follows) one can only wonder why it doesn't seem to appear in the
>Rev dictionary.  I did a fairly thorough search, and I supposed it might be
>a parameter (among other things), so I put in parameter as a search term and
>scrolled thru the list of parameters, and failed to find it.  If it is such
>a common convention, how come?
>  
>
The naming convention is unofficial, and does not need to be followed.
Not everyone follows it. It would therefore be misleading for it to be
documented by Rev; as you can see, their own examples in the docs do not
follow this convention (but I recommend you do - *one* full description
of *one* convention is at
www.fourthworld.com/embassy/articles/scriptstyle.html   - other people
use variations of it.

(In fact, there is lots of good stuff at  
www.fourthworld.com/resources/index.html )


>Answer: Everybody knows this...
>Reply:  No, they don't.... but if you want Rev to be scripting for the rest
>of us, you'll have to make it a bit easier to find it out.
>
>Thanks Alex.  As you can see, I have another agenda going here but I
>appreciate all the help I can get.  I need lots.
>  
>
Keep asking.

btw - I looked back at the Scripting Conference for Menus, and there is
a description of building "main menus" in there - but it's under the
title "Menu Bars", so you may not have seen it when you looked. It
includes an outline script - but it's basically only the same as the
outline created by menu, so you would probably still have run into the
same issue with the proper format of the switch structure.


--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17/02/2006

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Alex Tweedly

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
Ken Apthorpe wrote:

>Alex
>You say:
>on menuPick pWhich
>    switch pWhich
>        case "Exit"
>            answer "Are you sure you want to exit?" with "Yes" or "OK"
>            if it is "OK" then quit
>            break
>        case "Quit"
>           answer ....
>           if it is "OK" then ...
>           break
>    end switch
>end menuPick
>
>I'm sure this would work.  Problem is, I don't understand why.  This isn't
>your problem, you've given me a solution which is more than I could expect,
>thank you.
>
>  
>
Well, what I did was show you the fixed version of the switch control
structure .... I left the code within it unchanged.

>My problem with this script is:  it produces two choices, Yes or No. Buttons
>I assume.  OK is handled.  Yes does not appear to be handled by anything.
>But, if it works it must be handled somehow.  But there is nothing in this
>script (that I can see) to cater for a choice of Yes.
>
>It's a dilemma.  You say this works. I believe you (on faith, not having
>tried it).
>
As I said, I didn't change your code within the structure, so it may not
work (sorry about that - see below).

>But I can't see how it can possibly work, because there is
>nothing that appears to handle a choice of Yes.  Isn't programming supposed
>to follow the script?
>
>  
>
You don't necessarily need to handle all possible cases - e.g. if there
is nothing to do.
The code could have been
  answer "Really quit?" with "Yes" or "No"
  if it = "Yes" then quit

If the answer is "No", then you don't quit - so nothing needs to be done !


I've now done what I should have done in the first place ----
look in RevOnline, under username alextweedly there is a script called
 "Menu script for quit"
which has a working, tested script in it !  I'll fill in all the rest of
it later (e.g. some help info, more comments, etc") but I wanted to get
this very skeletal version up where you could read it asap.

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17/02/2006

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Ken Apthorpe

Re: Main menu puzzle, Klaus

Reply Threaded More More options
Print post
Permalink
In reply to this post by Klaus Major
Hi Klaus, and all others

This is getting out of control., I'm overwhelmed by the replies and can't keep up, so some may be delayed.  And in Australia and it's past midnight.  

Also  the forum seems to be unable to update in real time, I'm getting a blizzard of emails saying my replies haven't been sent because the mailbox is full, so there's a delay.

To answer Klaus.  I know Rev is event driven. Problem is it seems no one can explain the driving.  I get advice: do this (trust me, it will work).  Do that: (trust me, this will work (better)).  

I do trust you, and that the suggested solutions will work. What I don't get is a clear explanation of how and why they will work (in plain english, that, sadly, is all I understand).  If I am to use Rev, I need to know what I'm doing, and how/why it will work. Otherwise there is no point in even trying.

To summarise, most suggestions about my menu problem tell me to change the script.  As I based my various versions of the script on what Rev said (as best I could understand), but if you all tell me this was wrong, and I need to change it, it doesn't give me a lot of confidence in Rev or the Docs. It suggests to me that the instructions in the Rev Docs are not correct, or are so incomplete as to be misleading to new users.

This is not a good look.  It turns me off, and I'm persistent. Some will think to the point of stupidity.  Fair call, you may be right.  I could prove it by saying, well, hey, Donald Trump says never give up.  I'm not that stupid.   I've given up before, and I might again.  The last time I gave up with software was with Rev, in 2003.  For the much the same reasons.  There are lots of Rev experts, but few good teachers.

I'll answer other posts tomorrow.  Night.

Regards
ken


Eric Chatonet

Re: Main menu puzzle, Klaus

Reply Threaded More More options
Print post
Permalink
Hi Ken,

May be you should first dig in the docs to understand some basics:
About the message path, custom handlers and functions, parameters,  
etc. for instance.
The purpose of this list is to give *practical* answers (with some  
theory reminders if needed) but not to copy paste theory from the  
docs ;-)
It's the reason why others proposed some pieces of code to you.

I don't know which version of Rev you use: new 2.7 or a previous one.
The docs in 2.7 are not finished and, letting apart that they are not  
well organized, you might use the search engine to find topics,  
entries,, etc. related to menu, param, handler, etc.
And you can also search the PDF with Acrobat or Preview (Mac OS X).
With a previous version of Rev, download "Resources Picker", a plugin  
that will find for you in all fields (dictionary, topics, cookbook,  
FAQ, web, etc.) from keywords you specify.
You will find it by going to http://www.sosmartsoftware.com/

When you will have learned Rev basics, you'll feel much more at ease!
But you can't save on learning:
There are a lot of good *teachers* on this list (and above all kind  
people who share their knowledge and their time) but you have to make  
an effort by your own too ;-)
Take heart!

Best Regards from Paris,
Eric Chatonet

Le 18 févr. 06 à 16:04, Ken Apthorpe a écrit :

> Hi Klaus, and all others
>
> This is getting out of control., I'm overwhelmed by the replies and  
> can't
> keep up, so some may be delayed.  And in Australia and it's past  
> midnight.
>
> Also  the forum seems to be unable to update in real time, I'm  
> getting a
> blizzard of emails saying my replies haven't been sent because the  
> mailbox
> is full, so there's a delay.
>
> To answer Klaus.  I know Rev is event driven. Problem is it seems  
> no one can
> explain the driving.  I get advice: do this (trust me, it will  
> work).  Do
> that: (trust me, this will work (better)).
>
> I do trust you, and that the suggested solutions will work. What I  
> don't get
> is a clear explanation of how and why they will work (in plain  
> english,
> that, sadly, is all I understand).  If I am to use Rev, I need to  
> know what
> I'm doing, and how/why it will work. Otherwise there is no point in  
> even
> trying.
>
> To summarise, most suggestions about my menu problem tell me to  
> change the
> script.  As I based my various versions of the script on what Rev  
> said (as
> best I could understand), but if you all tell me this was wrong,  
> and I need
> to change it, it doesn't give me a lot of confidence in Rev or the  
> Docs. It
> suggests to me that the instructions in the Rev Docs are not  
> correct, or are
> so incomplete as to be misleading to new users.
>
> This is not a good look.  It turns me off, and I'm persistent. Some  
> will
> think to the point of stupidity.  Fair call, you may be right.  I  
> could
> prove it by saying, well, hey, Donald Trump says never give up.  
> I'm not
> that stupid.   I've given up before, and I might again.  The last  
> time I
> gave up with software was with Rev, in 2003.  For the much the same  
> reasons.
> There are lots of Rev experts, but few good teachers.
>
> I'll answer other posts tomorrow.  Night.

------------------------------------------------------------------------
----------------------
http://www.sosmartsoftware.com/    [hidden email]/


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Stephen Barncard

Re: Main menu puzzle

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
Ken, I'm sorry you're having problems, but like any language, you
need to learn the basics.

Why do you have to come to this forum? - because support is very
expensive, and Runrev has this wonderful, helpful culture that will
answer your questions. If runrev had to deliver the quality of
support you wanted, you'd have to pay for it. It's not because
they're mean, it's because they're sticking to their business plan.
They're a very small company and they very much want to survive.

I just read the excellent new 2.7 user's guide (userguide.pdf) that
steps through how everything works....This is really well-done.

   Ken, I don't know if you bought a copy of Rev or is just working
with a demo, but between the user guide and the scripting conference
stacks, the info is there.

You're mind is still trying to bend rev to the way other languages work...
You'll get it soon and will be one of the ones on this list giving advice.

sqb

>Thanks Alex
>
>I'll copy and paste that into my Rev tips file, so I remember it's a
>parameter name.  I still do not understand how pWhich can tell that I've
>picked a menu item like Quit (or Open, or anything else).
>
>So, how does a pWhich identify what's been picked?  (you see the dimensions
>of my ignorance).
>
>Comment for Rev support:
>I have to wonder why I had to go to a user forum and rely on helpful others
>to provide this information.  If it's a convention (ie something "everyone"
>knows, and follows) one can only wonder why it doesn't seem to appear in the
>Rev dictionary.  I did a fairly thorough search, and I supposed it might be
>a parameter (among other things), so I put in parameter as a search term and
>scrolled thru the list of parameters, and failed to find it.  If it is such
>a common convention, how come?
>Answer: Everybody knows this...
>Reply:  No, they don't.... but if you want Rev to be scripting for the rest
>of us, you'll have to make it a bit easier to find it out.
>
>Thanks Alex.  As you can see, I have another agenda going here but I
>appreciate all the help I can get.  I need lots.
>
>regards
>Ken
>

--
stephen barncard
s a n  f r a n c i s c o
- - -  - - - - - - - - -
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Mark Swindell

Re: Main menu puzzle, Klaus

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe

On Feb 18, 2006, at 7:04 AM, Ken Apthorpe wrote:

>
> To answer Klaus.  I know Rev is event driven. Problem is it seems  
> no one can
> explain the driving.  I get advice: do this (trust me, it will  
> work).  Do
> that: (trust me, this will work (better)).
>
> I do trust you, and that the suggested solutions will work. What I  
> don't get
> is a clear explanation of how and why they will work (in plain  
> english,
> that, sadly, is all I understand).  If I am to use Rev, I need to  
> know what
> I'm doing, and how/why it will work. Otherwise there is no point in  
> even
> trying.
>

This seems a bit extreme.  There is a level of understanding beyond  
which no one needs to understand further to get the job done.   Else  
perhaps we should start off with machine language and work our way up  
from there?  It really doesn't get more "English" than the X-Talks.  
I've created many very functional, useful tools without fully  
comprehending the intricacies of the code I've created and borrowed.  
(Especially when I go back to something after having not commented it.)

> To summarise, most suggestions about my menu problem tell me to  
> change the
> script.  As I based my various versions of the script on what Rev  
> said (as
> best I could understand), but if you all tell me this was wrong,  
> and I need
> to change it, it doesn't give me a lot of confidence in Rev or the  
> Docs. It
> suggests to me that the instructions in the Rev Docs are not  
> correct, or are
> so incomplete as to be misleading to new users.
>
> This is not a good look.  It turns me off, and I'm persistent. Some  
> will
> think to the point of stupidity.  Fair call, you may be right.  I  
> could
> prove it by saying, well, hey, Donald Trump says never give up.  
> I'm not
> that stupid.   I've given up before, and I might again.  The last  
> time I
> gave up with software was with Rev, in 2003.  For the much the same  
> reasons.
> There are lots of Rev experts, but few good teachers.

This also seems extreme.  There are many fantastic teachers on this  
list, and time after time they help the beginners, intermediates, and  
advanced users.  If you have specific problems understanding an  
explanation, I'd suggest you restate what you did understand, and re-
ask the specifics of what you didn't understand.  For example, what  
didn't you get about menupick pWhich?

This is coming from someone who is far from an "expert," and has  
struggled with many of the same concepts that you seem to be  
struggling with.  Parameters are, to me, the least well-explained and  
least intuitive aspect of Rev (and programming in general).  I  
thought Klaus did a good job in casting some light on them, but a  
good parameter tutorial would be good in the tutorials.  I think  
maybe Sarah Reichelt may have written one... I can't recall.

Good luck... I learn from the answers to your questions, and I'm sure  
others do too.

Mark
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Thomas McGrath III

Re: Main menu puzzle, Klaus

Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Apthorpe
Ken,

Welcome to the Revolution!

It is obvious that you could use a 'basic beginners' tutorial and  
might I suggest that you go to the revolution website and go through  
the Scripting Conferences for a basic introduction to the necessary  
elements of Revolution and how to understand it and use it. Just  
click here http://downloads.runrev.com/section/scriptingconferences.php
and go through them one at a time to learn the answers to your  
questions. After that go through the Video Tutorials located here  
http://support.runrev.com/tutorials/ .

Don't worry, this is not an experts list but is in fact a beginners  
list AND a place for us all to discuss problems we have when trying  
to script in Rev. So any questions you have should be answered very  
quickly. You may get more than one answer and 'Hey we are only human'  
and some answers may have mistakes in them as well. I post at least  
two or three mistakes a month. ;-)

Be patient and try not to be too complaining but rather just keep  
asking until you do understand what is being shown to you. If you  
have to vent your frustrations, then do so, we all have at some  
point. But then get back to the problem and look again at the  
solutions offered, eventually you will get it and then you will be  
here helping other new users soon enough.

Read the user guide, search the dictionary, search this list, go to  
RevOnline Users area and download sample stacks to see how others  
tackle problems, go through the excellent Video tutorials and the  
Scripting Conferences, go get Dan's book "software at the speed  
of..." etc. Check out user's websites with sample stacks, you can  
find a few here http://support.runrev.com/resources/ 
useful_sites.php . There is a plethora of information available and  
it would help you greatly to just jump in and start exploring.


Hope this helps,

Tom

On Feb 18, 2006, at 10:04 AM, Ken Apthorpe wrote:

>
> Hi Klaus, and all others
>
> This is getting out of control., I'm overwhelmed by the replies and  
> can't
> keep up, so some may be delayed.  And in Australia and it's past  
> midnight.
>
> Also  the forum seems to be unable to update in real time, I'm  
> getting a
> blizzard of emails saying my replies haven't been sent because the  
> mailbox
> is full, so there's a delay.
>
> To answer Klaus.  I know Rev is event driven. Problem is it seems  
> no one can
> explain the driving.  I get advice: do this (trust me, it will  
> work).  Do
> that: (trust me, this will work (better)).
>
> I do trust you, and that the suggested solutions will work. What I  
> don't get
> is a clear explanation of how and why they will work (in plain  
> english,
> that, sadly, is all I understand).  If I am to use Rev, I need to  
> know what
> I'm doing, and how/why it will work. Otherwise there is no point in  
> even
> trying.
>
> To summarise, most suggestions about my menu problem tell me to  
> change the
> script.  As I based my various versions of the script on what Rev  
> said (as
> best I could understand), but if you all tell me this was wrong,  
> and I need
> to change it, it doesn't give me a lot of confidence in Rev or the  
> Docs. It
> suggests to me that the instructions in the Rev Docs are not  
> correct, or are
> so incomplete as to be misleading to new users.
>
> This is not a good look.  It turns me off, and I'm persistent. Some  
> will
> think to the point of stupidity.  Fair call, you may be right.  I  
> could
> prove it by saying, well, hey, Donald Trump says never give up.  
> I'm not
> that stupid.   I've given up before, and I might again.  The last  
> time I
> gave up with software was with Rev, in 2003.  For the much the same  
> reasons.
> There are lots of Rev experts, but few good teachers.
>
> I'll answer other posts tomorrow.  Night.
>
> Regards
> ken
>
>
>
> --
> View this message in context: http://www.nabble.com/Main-menu- 
> puzzle-t1145446.html#a3005878
> Sent from the Rev Pilgrim's Progress forum at Nabble.com.
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

Thomas J McGrath III
[hidden email]

Lazy River Software™ - http://www.lazyriversoftware.com

Lazy River Metal Art™ - http://www.lazyriversoftware.com/metal.html

Meeting Wear™ - http://www.cafepress.com/meetingwear

Semantic Compaction Systems - http://www.minspeak.com

SCIconics, LLC - http://www.sciconics.com/sciindex.html







_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
J. Landman Gay

Parameters [WAS: Main menu puzzle]

Reply Threaded More More options
Print post
Permalink
In reply to this post by Mark Swindell
Mark Swindell wrote:
>
> Parameters are, to me, the least well-explained and  least
> intuitive aspect of Rev (and programming in general).

The concept of parameters can be very tricky for lots of people new to
programming. I've explained it before on other lists, but I can't find
my old notes. But let me take another shot at it here.

A parameter is simply a variable that is declared at the start of a
handler. My favorite analogy for a parameter is a "basket". Your script
states that there is a basket (a variable) available to hold some
information. The Rev engine then fills that basket with something when
it sends the corresponding event message. Your script can then use the
information inside that basket however it wants.

Let's look at the menupick message, since that's the one that came up on
the list:

on menupick myBasket
   ...

By putting "myBasket" after the handler declaration, we have defined
that there is a parameter variable available to hold whatever data  the
engine sends. In the case of menupick, the data that fills that basket
will be the name of the menu item the user has chosen. The variable
"myBasket" will therefore hold something like "Exit" or "Copy".

Like any other variable, it doesn't matter what you name the basket. The
parameter can be named anything; it is merely the act of naming it and
including it in the handler declaration that is important. In general,
it is best to name parameters in a way that describes what they will
contain. This helps a great deal later on when you are reading a script
and you need to remember the kind of data that the variable contains.

Therefore, in the case of a menupick parameter, a good name for the
parameter variable might be "userChoice", or "userItem" or something
similar. Some people like to name parameter variables prefaced with a
"p" (i.e., "pUserChoice") so that they remember when reading the script
later on that it was a variable passed as a parameter rather than a
variable they declared in the script. This isn't a rule, just a
convention that some people like to follow for clarity.

You can have any number of parameters declared in a handler:

on myHandler pOne,pTwo,pThree <etc>
  ...

If the engine (or one of your own handlers) passes three parameters to
this handler, each parameter "basket" will hold one of the items that is
passed to it.

If more parameter items are passed than you have declared parameter
"baskets" to hold, the extra ones are not available to your script.
(There is a way around this using "the params" but that is more advanced
than we want to talk about here.)

If fewer parameter items are passed to your handler than you have
"baskets" declared, the extra baskets are empty.

Feel free to ask for clarification, I wrote this very quickly.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
1 2 3 4