Learning DX Step-By-Step - #7
Replacing the RIGHT-CLICK menu! - Advanced Scripting
Thursday, March 1, 2007 by RomanDA | Discussion: DesktopX Tutorials
![]() ![]() |
|||
Script Tutorials |
#7 - Replacing the Right-Click Menu |
||
A series by RomanDA |
|||
Listing of other DX Tutorials:
Click
here This lesson is more
advanced then the previous ones I have posted.
This is not going to be a simple STEP-BY-STEP, I'm assuming if you are this advanced into DX, I don't need to explain how to get the script windows up, or edit properties! This is more like a SCRIPT example, not a step-by-step. ---- UPDATE - REVISED THE CODE and uploaded this as a widget for you to download and enjoy HERE For this and all the Step-By-Step DX Tutorials you will need to purchase DesktopX for $14.95 from Stardock. Lets get started. |
|||
STEP 1 - RegisterController | |||
In order for DX to ignore
the built-in right-click menu, you have to work a little magic. Its not that complex, but it has to be setup in order to work.
|
|||
STEP 2 - OnControl Function | |||
The OnControl function
handles clicks on the tray icon, as well as right clicks coming from
your widget.
|
|||
STEP 3 - Adding the POPUP Menu | |||
The popup menu is the menu
you want to show up when you RIGHT-CLICK on the widget/tray when the
widget is not minimized, etc. (We will do the minimized version in a
min). I am not going to rip this all apart, there is another tutorial out there on making a right-click menu
|
|||
STEP 4 - Minimized (Tray icon) menu | |||
We are going to add a
minimized menu, so that we have a way to restore the widget back to
working order from minimized state. Its not going to have all the
functions of the main popup menu. This menu will only be accessible with its minimized and from the tray icon.
|
|||
STEP 5 - Add Left-Click menu | |||
If you want you can also
make the popup menu show when you LEFT-CLICK on the object as well. This is a simple bit of code to be added to the object.
|
|||
CONCLUSION |
|||
This should all work, there
are a lot of options in the ONCONTROL function, as far as clicking
works, this shuts off the CLICK HIDE/CLICK RESTORE on the tray icon as
well, it has a way of messing things up. This is not something i would recommend someone doing unless you really know DX. One side effect of this is that you cant right-click on the main object anymore, it wont work, you will just get your menu (when editing things!!). AND you will not be able to right-click the DX TRAY icon to pick edit, etc. So just a warning. I hope you have enjoyed this step into DX, and look forward to the next installment..
|
Reply #2 Friday, March 2, 2007 12:51 PM
I saved it for later use.I'm not there yet.I save all your articles. Really do appreciate them I learn something from all of them

Eddie
Reply #3 Friday, March 2, 2007 1:08 PM
Reply #4 Saturday, March 3, 2007 5:36 AM

Thanks RomanDA, this is very much related to threads i have been knocking about in recently, as you know! Nice one...
Ronan H
Reply #5 Saturday, March 3, 2007 5:10 PM

This seems to be one of the more popular questions lately.
Reply #6 Friday, March 9, 2007 5:35 PM
Reply #7 Wednesday, June 27, 2007 6:16 PM
Just wanted to mention this line:
Call PopupMenuMin
doesn't match the actual function's name: PopupMenuTray()
Also, any ideas why when I export my widget I have to click twice on the systray icon? I click it once and it flashes. Then I have to click it again.
And is there any way to make it disappear if I don't select anything from the menu?
Reply #8 Sunday, February 10, 2008 7:14 AM
doesn't match the actual function's name: PopupMenuTray()
fixed code.. thanks.
im not sure about the double clicks, the best way to test things is to make a TEXT Object and have it pass all the codes being sent by the right-click handeler to it to see what codes make things work.
Create "TEST" object
ie:
Function OnControl(lType, lCode)
OnControl = True 'Allow control to run
desktopx.object("TEST").text = desktopx.object("TEST").text & vbnewline
desktopx.object("TEST").text = "LType: " & lType & "LCode: " & lCode
End Function
This way you can see what its passing..
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!
Reply #1 Thursday, March 1, 2007 12:57 PM
Thanks!