Author Topic: Adding a configuration & tools programmatically?  (Read 1752 times)

aurora_borealis

  • Community Member
  • Posts: 5
  • Hero Points: 0
Adding a configuration & tools programmatically?
« on: November 15, 2011, 11:04:50 pm »
I'm trying to automate the process of adding certain, 'known' configurations, as well as their corresponding tools. While this can be done via lots of menus and mouse clicks, I'd like to do this programatically, using Slick-C.

So far, I've found that I can use the elusive '_ProjectAddTool' function to add a 'tool' to an existing configuration (e.g. 'Debug'). The '_ProjectAdd_Target' works even better. This really only leaves the actual custom configuration bit to sort out. I've looked through SlickEdit's bundled macros and the only thing I've found that would allow this to happen is something like this statement from '\macros\p_config.e':
Code: [Select]
int newIndex=_TreeAddItem(index,NewConfigName,flags,_pic_fldopen,_pic_fldopen,-1);
The only parameter that seems to be giving problems is that of 'index', which is set to the bottom of the current tree object (which happens to be a _control object). I'm not exactly sure how this should best be set up, as the macro I was looking at is a bit convoluted. Is there a more concise example of this anywhere?

Any input is appreciated. Thanks!
« Last Edit: November 17, 2011, 05:19:56 pm by aurora_borealis »

Graeme

  • Senior Community Member
  • Posts: 2161
  • Hero Points: 268
Re: Addint a configuration & tools programmatically?
« Reply #1 on: November 16, 2011, 09:50:13 am »
Hi Aurora

I'm confused by your question.  The functions you mention (_ProjectAdd_Target etc) modify the xml representation of the project.  The _TreeAddItem function modifies the content of the TreeCtrl that is displayed in the new configuration dialog box.  The TreeCtrl exists only when the dialog is visible  - so in your case, the tree control won't exist because you're doing it programmatically and you don't need to call _TreeAddItem.  As in the ctlConfigNew.lbutton_up() function, won't you want to call _xmlcfg_set_attribute(gProjectHandle,NewConfigNode,'Name',NewConfigName);
to add the new config to the project ??