RightClick

Discuss and ask questions about CADEditorX and XML API.

Moderators: SDS, support, admin

Post Reply
agvs
Posts: 30
Joined: 16 Jun 2016, 11:10

RightClick

Post by agvs » 07 Nov 2016, 15:21

Hello,
I’d like to proceed the defined window by me after right click.
See the attached picture, please.
That picture is to follow your window for selecting something after right click.
In my case, I want to change to follow defined window which is made by me after right click.
Let me know please.
Attachments
rightclick.jpg
rightclick.jpg (126.66 KiB) Viewed 27918 times

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: RightClick

Post by support » 07 Nov 2016, 18:18

Hello,

To replace the existing context menu items with the custom ones, use the following XML code:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">     
  <contextmenu mode="0">                     
    <items>                         
      <item Caption="Menu Item 1" Sender="$00000000" onClick="$00000000" onPopup="$00000000"/>
    </items>
  </contextmenu>
</cadsofttools>
Each menu item has two events - OnClick and OnPopup. The OnClick event fires when user clicks on the custom menu item with the mouse. The OnPopup event fires when the custom menu pops up on the screen.

Sender (optional parameter) is a pointer to the sender object which raises the event (say OnClick, it's the context menu item). onClick and onPopup (optional parameter) are method pointers, they take the actual addresses of the methods which are supposed to be event handlers in your code for the OnClick and OnPopup events, respectively. Given the fact that Sender and onPopup are optional parameters, you may omit them and specify only the address of the OnClick event handler, for example:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">     
  <contextmenu mode="0">                     
    <items>                         
      <item Caption="Menu Item 1" onClick="$00000000"/>
    </items>
  </contextmenu>
</cadsofttools>
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

agvs
Posts: 30
Joined: 16 Jun 2016, 11:10

Re: RightClick

Post by agvs » 14 Nov 2016, 07:24

Thank you for your explanation.
I'd like to know exactly 'onClick'.
Let me know, please.
Thanks,

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: RightClick

Post by support » 14 Nov 2016, 14:55

Hello,
To run the OnClick event use the code mentioned above
<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">
<contextmenu mode="0">
<items>
<item Caption="Menu Item 1" onClick="$00000000"/>
</items>
</contextmenu>
</cadsofttools>
As a result you'll get a Menu Item 1 listed in the Context menu Window:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<cadsofttools version="2.0">
  <Results>
    <Result Instruction="OnMenuContextClick" Type="event" guid="{D468D130-40F2-4294-A8F9-2C31A0BD12F3}">
      <Output caption="&Menu Item 1" index="0"/>
    </Result>
  </Results>           
</cadsofttools> 
You can change the Menu Item 1 to the required item.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply