Author Topic: Hook event related to XMLCFG node use?  (Read 2863 times)

aurora_borealis

  • Community Member
  • Posts: 5
  • Hero Points: 0
Hook event related to XMLCFG node use?
« on: April 16, 2012, 08:11:54 pm »
I currently use the "Projects" toolbar in "Directory View" to navigate through source code. I would like to be able to select an XMLCFG node and perform a specific action with it. The way I see it, there are several ways to accomplish this:

1) Overload the default macros and re-do the context menu(s). This seems like a very bad idea, involving a lot of work, and is strongly advised against in the SlickEdit documentation.

2) Have a custom button somewhere at the top of the SlickEdit UI that would launch a form that allows me to choose from a set of contextual options ('open directory (that corresponds to the selected XMLCFG node)', 'compile the corresponding directory tree under this node', and so forth). This is not a bad solution, but it has its limitations. For one, the 'menu form' here would not be dynamic, as I would like it. While I can create or customize a form 'on-the-fly' (using a macro), it turns out that I cannot load and display (using _command_execute('myform.e')) a menu form all during the execution of one macro. Apparently, when you call load('myform.e'), it only executes after the current macro has completed.

3) Have an event that fires when I do something to an XMLCFG node. There is still the aforementioned problem of not being able to create a form and load it all at once, but this is still more convenient than clicking a button somewhere far away in the UI.
Ideally, this event would be fired upon a double-click on an XMLCFG node. But clicking and dragging a node or something along those lines would also work. The problem is, I have no idea how to hook such an event. I looked at this thread and I don't see a way just yet. Maybe using something like _onfocus_?

Please advise!

Graeme

  • Senior Community Member
  • Posts: 2517
  • Hero Points: 327
Re: Hook event related to XMLCFG node use?
« Reply #1 on: April 18, 2012, 12:05:18 pm »
I currently use the "Projects" toolbar in "Directory View" to navigate through source code. I would like to be able to select an XMLCFG node and perform a specific action with it. The way I see it, there are several ways to accomplish this:

1) Overload the default macros and re-do the context menu(s). This seems like a very bad idea, involving a lot of work, and is strongly advised against in the SlickEdit documentation.

2) Have a custom button somewhere at the top of the SlickEdit UI that would launch a form that allows me to choose from a set of contextual options ('open directory (that corresponds to the selected XMLCFG node)', 'compile the corresponding directory tree under this node', and so forth). This is not a bad solution, but it has its limitations. For one, the 'menu form' here would not be dynamic, as I would like it. While I can create or customize a form 'on-the-fly' (using a macro), it turns out that I cannot load and display (using _command_execute('myform.e')) a menu form all during the execution of one macro. Apparently, when you call load('myform.e'), it only executes after the current macro has completed.

3) Have an event that fires when I do something to an XMLCFG node. There is still the aforementioned problem of not being able to create a form and load it all at once, but this is still more convenient than clicking a button somewhere far away in the UI.
Ideally, this event would be fired upon a double-click on an XMLCFG node. But clicking and dragging a node or something along those lines would also work. The problem is, I have no idea how to hook such an event. I looked at this thread and I don't see a way just yet. Maybe using something like _onfocus_?

Please advise!

Your link didn't work.  Did you mean this?
http://community.slickedit.com/index.php?topic=84.0%22

You could have a look at the project toolbar context menu addons that I posted here
http://community.slickedit.com/index.php/topic,5633.0.html

You can edit the project toolbar context menus.  On the macro menu in slickedit, select "Menus" then open one of the menus that begins with _projecttb_  e.g. _projecttb_file_menu.  You can add your own commands.

aurora_borealis

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Hook event related to XMLCFG node use?
« Reply #2 on: April 20, 2012, 05:26:04 pm »
That's the URL I had in mind and I'll try modifying the context menus by modifying the form. Thanks!