Main menu puzzle

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 - 3 - 4 | Next >

Main menu puzzle

by Ken Apthorpe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Main menu puzzle

by Ken Apthorpe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

Parent Message unknown Re: Main menu puzzle

by Alex Tweedly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Parent Message unknown Re: Main menu puzzle

by Alex Tweedly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Parent Message unknown Re: Main menu puzzle

by Kay C Lan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2/18/06, Ken Apthorpe <ken.apthorpe@...> 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
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Parent Message unknown Re: Main menu puzzle

by Alex Tweedly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: Main menu puzzle

by Ken Apthorpe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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




Re: Main menu puzzle

by Ken Apthorpe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



Re: Main menu puzzle

by Ken Apthorpe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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




Parent Message unknown Re: Main menu puzzle

by Klaus Major :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
klaus@...
http://www.major-k.de

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

Parent Message unknown Re: Main menu puzzle

by Klaus Major :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
klaus@...
http://www.major-k.de

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

Parent Message unknown Re: Main menu puzzle

by masmit :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
> use-revolution@...
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

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

Parent Message unknown Re: Main menu puzzle

by Alex Tweedly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Parent Message unknown Re: Main menu puzzle

by Alex Tweedly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: Main menu puzzle, Klaus

by Ken Apthorpe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



Parent Message unknown Re: Main menu puzzle, Klaus

by Eric Chatonet :: Rate this Message: