PDA

View Full Version : rcmenu on button


galagast
03-08-2005, 11:09 AM
how do I create an rcmenu when i RMB click over a button?
I could only activate a popupmenu with a LMB click... under the on btn1 pressed do handler,
and popupmenus over an entire rollout using on rollout rbuttondown pos do, i cant find the right keyword for a right click over a specific button inside a rollout... is ther a way to do that?

Tak Tak
03-08-2005, 11:34 AM
I'm planning to discover same thing tonight :)
I think you(and me) should use Andre Hotz's SkinodDie script as example. He uses a lot of RC menus on that script so...

Good luck!

Tak Tak
03-08-2005, 06:48 PM
Oops... I was misunderstanding your question. I thought you was asking about simple RCmenu thing but... Sorry.

galagast
03-09-2005, 01:16 AM
no biggie, happens all the time. :thumbsup: thanks for the link, i also had a lot to learn from the script that you mentioned.

but i still havent solved this problem... i dont even know if its possible... (in maxscript, anything is possible!)<--:D

ofer_z
03-09-2005, 03:16 AM
hi galagast,

this has been discussed on the discreet forum before. check out these links:
http://support.discreet.com/webboard/wbpx.dll/read?190197,15e#190197
http://support.discreet.com/webboard/wbpx.dll/read?191130,15e#191130


hOpe this helps,
o

galagast
03-09-2005, 04:01 AM
hmm.. i cant seem to connect to the link...
do you recall the topic title? coz i tried searching for "rcmenu" on the webBoards but didnt get any useful info on the topic... ill do some more searches... hehe... thanks by the way!:)

galagast
03-09-2005, 04:12 AM
found it!


As for right clicks, I don't think there is a control that traps right-click events except for a few cool activeX controls.



i guess i myt just hav look into those activeX controls... I hope that they'd implement somethind like this in the future. :) thanks again sir ofer_z!

Tak Tak
03-09-2005, 04:49 PM
I discovered SkinorDie script last night but I don't really understand how RC-menu should write... I have checked MAXScript ref also, but just don't get it. If some one please give me some simple example like "on AAA_btn pressed do...open RCmenu...".

Thanks.

ofer_z
03-09-2005, 05:14 PM
hi galagast,

it seems you didn't find the second link, which i think you'll find interesting. the topic of that thread is: "New Maxscript Control (check it out)." do a search for that... :)


cheers,
o

ofer_z
03-09-2005, 05:28 PM
I discovered SkinorDie script last night but I don't really understand how RC-menu should write... I have checked MAXScript ref also, but just don't get it. If some one please give me some simple example like "on AAA_btn pressed do...open RCmenu...".

Thanks.

Tak Tak,

check out this example:





rollout roTest "test"
(

local rcTest

-- declare the RC Menu to be used later...
-- NOTE: a function is used to create a LOCAL rc menu (otherwise you get an error
-- that a rollout clause is expected,) you could, however, just define the
-- RC Menu outside the rollout scope, in which case you don't need the function.
fn createMenu =
(
rcMenu rcTest
(
menuItem miItem1 "Item 1"
menuItem miItem2 "Item 2"
seperator menuSep01
menuItem miItem3 "Item 3"

on miItem1 picked do (print "item 1 picked...")
on miItem2 picked do (print "item 2 picked...")
on miItem3 picked do (print "item 3 picked...")
) -- end of rcTest rcmenu
)


-- now declare the rollout controlers
button bnMenu "Click here for the menu..." width:150

on bnMenu pressed do (
-- use the popUpMenu command to display the RC Menu we defined earlier...
popUpMenu rcTest pos:(bnMenu.pos + [145,0]) rollout:roTest align:#align_topleft
)

-- on rollout open we call the createMenu fn to define the local RCMenu
on roTest open do createMenu()

)-- end of roTest rollout

createDialog roTest



hOpe this helps,
o

Tak Tak
03-09-2005, 05:55 PM
Thanks for reply and nice script tutorial ofer_z!!!

I'm sure it will help me. (good comments)
:bounce:

galagast
03-10-2005, 10:38 AM
cool! (i saw the thread) although i was hoping for some kind of a method to do it without adding or installing a plugin...
Hmm.. i just got an idea.. i think i could overlap a button over a disabled imgtag, that way i could check if the the mouse is over the button, then maybe i could just set a switch for the on rbuttondown handler to check... (something like if switch == 1 then do...) ... this just might work.. still have to test it though... anyway.. thanks again for the reply! cool way to call an rcmenu by the way... i dont put my rcmenus inside functions (never though of it, never occured to me, hehehe)... but now, i guess your approach is way better.:thumbsup:

galagast
03-10-2005, 12:06 PM
rollout test_roll "test rollout" width:162 height:51
(
local switch = false
local myrcmenu

fn openrcmenu =
(
rcmenu myrcmenu
(
menuitem testitem1 "test 1"
menuitem testitem2 "test 2"
)
)

ImgTag invi_imgtag "" pos:[8,8] width:60 height:20
--button rc_button "right+click" pos:[8,8] width:60 height:20
button switch_bot "switch" pos:[80,8] width:60 height:20

on invi_imgtag mouseover do
(
print "inside"
invi_imgtag.visible = false
print invi_imgtag.visible
switch = true
)
on invi_imgtag mouseout do
(
print "outside"
invi_imgtag.visible = true
print invi_imgtag.visible
switch = false
)
on test_roll open do
(
openrcmenu()
print "registered rcmenu"
)
on test_roll rbuttondown the_pos do
(
if switch then
(
popupmenu myrcmenu
)
else
(
print "off"
)
)
on switch_bot pressed do
(
switch = (not switch)
print switch
)

)createdialog test_roll


i thought it was gonna work.. but to my dismay, i guess i still have to look for another way... i just posted the script that i was working on just in case anyone also wants to try it out, or maybe suggest some other ideas... **sigh**

CGTalk Moderation
03-10-2005, 12:06 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.