A Little Menu Issue

View: New views
5 Messages — Rating Filter:   Alert me  

A Little Menu Issue

by Len Morgan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The most frustrating thing about Rev is how it makes me feel like a
complete idiot sometimes!

I'm trying to implement a popup menu and it's just not working right. I
read and reread the script conference and have done everything exactly
as it was written there.

My problem is I can get the menu to display but it never goes away and
doesn't seem to call my menuPick handler either.

I have the menu in a hidden button on the one and only card in my
stack.  I have a scrolling field that contains employee numbers and
their names, one per line.  What I want to do is:

If the user right clicks on a name or number, popup my menu and let them
select "Add, Delete, Edit" and then be able to popup another stack that
let's them make the appropriate change.  Like I said, a right click WILL
popup the menu and it does highlight the selection I'm making but the
menu never goes away and locks up everything.

It should be noted that I put a debug statement just before and just
after the "popup button mybutton" command and when I right click on the
field, both messages get printed before I have selected ANYTHING from
the popup menu.  It appears like the popup command is sent but it
immediately returns to the calling handler (in my case, the right-click
in the scrolling field).

What could be up with this?  My field has a mouseUp handler for the
right click, and my button has a menuPick handler for the choice.

Also, is there a way I can pass the line that was clicked on to the
popup command so that when a choice is made, my little "editor" can have
the number and name of the person that was selected?  Alternatively, can
I pass back the selection that was made to the field mouseUp handler and
let it remember which line the mouse was clicked on?

Thank you!

len morgan
_______________________________________________
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: A Little Menu Issue

by J. Landman Gay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Len Morgan wrote:

> My problem is I can get the menu to display but it never goes away and
> doesn't seem to call my menuPick handler either.

The menuMousebutton property should be set to zero. Check the button
inspector to make sure that's the case.

> What could be up with this?  My field has a mouseUp handler for the
> right click, and my button has a menuPick handler for the choice.

You need to call the popup command in a mousedown handler. Then in a
menupick handler, deal with the menu selection. The field won't see any
messages that come from the button; you'll have to send that info to the
field after the button retrieves it.

>
> Also, is there a way I can pass the line that was clicked on to the
> popup command so that when a choice is made, my little "editor" can have
> the number and name of the person that was selected?  Alternatively, can
> I pass back the selection that was made to the field mouseUp handler and
> let it remember which line the mouse was clicked on?

It works the other way around. The selected menu item text is passed to
the menupick handler. Then you can do whatever you want with it. Here's
a sample button script for a popup button named "myMenuBtn":

on mousedown
  popup "myMenuBtn"
end mousedown

on menupick pWhich
  put pWhich into theSelectedText
  -- now you have the user's choice; send it to the field, or whatever
end menupick

You can also use a switch statement in the menupick handler, just like
any other menu, if that's easier for what you want to do.

The button's "menuhistory" property will store the last line that was
selected in the button's menu. So if you want a line number, you can get
it from the popup button directly:

  put the menuhistory of btn "myMenuBtn" into tLastLineNum

--
Jacqueline Landman Gay         |     jacque@...
HyperActive Software           |     http://www.hyperactivesw.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

Re: A Little Menu Issue

by J. Landman Gay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

J. Landman Gay wrote:

> It works the other way around. The selected menu item text is passed to
> the menupick handler. Then you can do whatever you want with it. Here's
> a sample button script for a popup button named "myMenuBtn":
>
> on mousedown
>  popup "myMenuBtn"
> end mousedown
>
> on menupick pWhich
>  put pWhich into theSelectedText
>  -- now you have the user's choice; send it to the field, or whatever
> end menupick

Well, this is completely wrong, sorry, it was a major think-o. Obviously
your popup button is invisible. And the above isn't right for a visible
button anyway.

You are correct to put the mousedown handler into the field, which then
issues the "popup" command. The above menupick handler does go into the
button that is popped up.

Check the menuMousebutton property though, that may be the problem.

--
Jacqueline Landman Gay         |     jacque@...
HyperActive Software           |     http://www.hyperactivesw.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

Parent Message unknown RE: A Little Menu Issue

by Len Morgan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Jacqueline (I don't know if you like your full name or "Jackie")

I subscribe to the "digest" version of the list and I don't know how to
respond to your answer with previous contents unless I subscribe to the
"individual message" mode.

The "menuMouseButton" was the first problem.  That is now working the way
I expected it to...sort of.  I'm still getting my "going to" pop-up message
and then immediately "back from" pop-up message in my debug window while
the menu is being displayed.  Shouldn't a pop-up be a modal window that
locks all other interaction until a choice is made (or escape is pressed)?

I also still have the issue of knowing which line the user was on when
they right clicked (so I know what name to change).  Do I need to save
the line number the mouse was on in the field BEFORE I send the popup
command?

Also, since the mouseUp handler in the field that calls the popup is
continuing without waiting for a response from the user, where is my
menuPick message in the button supposed to send the selection the user
made? To another handler in the field that is responsible for putting
up the Add/Edit/Delete screens?  Is the mouseUp handler "done" after
it has issued the "popup" command to my menu button?

Thanks again!

len morgan

_______________________________________________
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: A Little Menu Issue

by J. Landman Gay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Len Morgan wrote:
> Thanks Jacqueline (I don't know if you like your full name or "Jackie")

Anything. My mother calls me "Jack". Most people call me "Jackie," but I
spell it "Jacque". That has caused some list people to think I'm male --
so I started signing "Jacqueline" a long time ago to avoid confusion.
I'll answer to "hey you" too.


> Also, since the mouseUp handler in the field that calls the popup is
> continuing without waiting for a response from the user, where is my
> menuPick message in the button supposed to send the selection the user
> made? To another handler in the field that is responsible for putting
> up the Add/Edit/Delete screens?  Is the mouseUp handler "done" after
> it has issued the "popup" command to my menu button?

Change the mouseUp handler in the field to a mouseDown. Popup buttons
should be called from a mouseDown handler. That forces the menu to wait
for a mouseup, which closes the menu. If the mouseUp happens outside the
menu, it closes without doing anything (just like pressing escape.) If
the mouseUp happens inside the menu, the button's menuPick handler is
triggered.

So, in the field:

on mouseDown
  popup btn "myMenuBtn"
end mouseDown

And in the menu button:

on menuPick which
  -- handle the menu selection
end menuPick

--
Jacqueline Landman Gay         |     jacque@...
HyperActive Software           |     http://www.hyperactivesw.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
LightInTheBox - Buy quality products at wholesale price