Page 1 of 1

Right Click starter

Posted: Fri Jul 03, 2009 4:17 pm
by Damlimey
Hello all,

In my project, I have a button that I would like to offer 'right click' options for, ie; Load a file, clear a file, etc...

Where can I find a tutorial on this and does anyone have any advise or tips for this very inexperienced traveler in Runtime?

Thanks in advance,

D

Posted: Sat Jul 04, 2009 5:45 am
by shadowslash
You might want to consider using popup buttons. You can do so by dragging the PopUp Menu control from the tools palette to your stack.
Image

Posted: Sat Jul 04, 2009 6:44 am
by Janschenkel
If you wqant your button to work for both left- and right-button clicks, doing some action for the left-button, and displaying the menu when right-clicking, then the following method will work best.
Put a popup-menu next to your button, name it "ContextualMenu" and set its menu content using the Inspector palette; set its script to

Code: Select all

on menuPick pMenuItem
  answer pMenuItem
end menuPick
and finally hide it. Then set the script of your button to

Code: Select all

on mouseUp pMouseButton
  if pMouseButton is 1 then  -- left-button click
    ... do your normal thing ...
  else
    popup button "ContextualMenu"
  end if
end mouseUp
Now, when you left-click on the button, it continues to work as normal; when you right-click, the contextual menu pops up - and when you choose one of its items, the script simply tells you which item you picked.

Jan Schenkel.

Oh yeah!!!

Posted: Sun Jul 05, 2009 8:50 am
by Damlimey
Far out guys! Thanks for that, it's working a treat so, while I have your attention...

I've succesfully managed to load a music file into a button, I can play it and puase it with that button, I can make options available by a right click menu now thanks to you guys but... How do I empty the button before I put a new file in it? ie, I just want an empty button.

Yours truly,

D

Posted: Sun Jul 05, 2009 8:54 am
by shadowslash
Hi damlimey,

When you say succesfully managed to load a music file into a button, what do you mean? Did you put it in a custom property? What exactly do you want to achieve when you say I just want an empty button how empty? As in without any menus? As in without any text? Please specify. Image

Hi Shadowslash...

Posted: Sun Jul 05, 2009 9:15 am
by Damlimey
I'm building an audio player and as I'm on a massive learning curve here, I've built several basic stacks and I use each stack to work out and test one or two simple functions at a time.

The plan is to have a button which I can load with a music file and then play it when I click the button. However, I want to be able to "purge" the player so that it is empty. I can then add a different file if required.

I use a load button to load the player, a play/pause button to... Well play & pause but I would like to offer the "load .wav" and "remove.wav" options as part of the right click menu.

However, I'm finding it hard to track down any examples of a simple "on mouse down" type of code to simply clear the current file from the player.

Sorry to go on and on but does this help?

D

Posted: Sun Jul 05, 2009 11:56 am
by Klaus
Hi D,

we need more info, since we do not know how you are doing what you are doing.

Are you setting the filename of player with "load a music file into a button"?
If yes, then the magic line is:
...
set the filename of player "XYZ" to empty
...

If not, well, see line 1 :-)


Best

Klaus

That does it...

Posted: Sun Jul 05, 2009 1:21 pm
by Damlimey
Hi Guys,

Yes, that does the trick, that's all I needed to know at this stage. Now I can load and unload a music file from the player. Next step is to put the unload option into the right click menu and I can move onto the next mystery.

The device I'm trying to create is essentially for sound engineers like me, who have to fire sound effects and music stings into a production on very short notice. The idea is to have a page with say 20 "players" on it, each loaded with various music files ready to go at the click of a mouse.

Some files may be changed during the event hence a right click function menu to remove/reload files.

I don't want to use propriatory dedicated devices costing thousands os euros though, I want to use a simple bit of PC software.

Regards,
D

Posted: Tue Jul 07, 2009 6:39 am
by shadowslash
Well it's a good thing that you settled for RunRev. A lot of people seem to think that Rev is complicated but it's not. I myself thought of that before but when I spent a couple of days with Rev and checking the sample stacks and of course, getting some help from forum users, I managed to get around my problems... Image Just take a look at this story of a guy who got locked out and saw the real ease of Rev. http://forums.runrev.com/phpBB2/viewtopic.php?t=3223 Image