Author Topic: How to expand/collapse function with hotkey ?  (Read 12046 times)

inventec

  • Community Member
  • Posts: 10
  • Hero Points: 0
How to expand/collapse function with hotkey ?
« on: October 26, 2006, 02:44:57 am »
In c files, used by function heading/show all which in view menu, we can view or edit program simply .

Sometimes, I always double click the heading icon(+/-)  for processing one function only, because I don't know what is hotkey .

It's so trouble .

Somebody who knows it tell me how to do it, please !

Thank you !


hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: How to expand/collapse function with hotkey ?
« Reply #1 on: October 26, 2006, 07:40:05 am »
Bind a key to 'plusminus'.

HS2

at5dapa1

  • Senior Community Member
  • Posts: 166
  • Hero Points: 15
Re: How to expand/collapse function with hotkey ?
« Reply #2 on: October 26, 2006, 09:27:04 am »
Thanks HS2, indeed very useful to know this!
By the way, do you know if is possible to instruct SE, to open by default any file in "Selective Display" mode?

Graeme

  • Senior Community Member
  • Posts: 2321
  • Hero Points: 305
Re: How to expand/collapse function with hotkey ?
« Reply #3 on: October 26, 2006, 10:11:45 am »
Bind a key to 'plusminus'.

HS2

Wow.  You're a master of SlickEdit HS2!  :)

I hope the SE doc team is reading this thread coz plusminus doesn't appear in the help anywhere!

Graeme

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: How to expand/collapse function with hotkey ?
« Reply #4 on: October 26, 2006, 01:05:58 pm »
Thanks HS2, indeed very useful to know this!
By the way, do you know if is possible to instruct SE, to open by default any file in "Selective Display" mode?

I think you would have to write a hook macro (I think it would be in the form _buffer_add_xxxx, but I can't remember), and then call one of these functions:

all
allnot
hide_all_comments
hide_code_block
hide_selection
preprocess
selective_display  // probably don't want this one - it activates the GUI dialog
show_all
show_braces
show_col1
show_current_proc
show_indent
show_paragraphs
show_procs
show_selection
« Last Edit: October 26, 2006, 01:13:36 pm by Wanderer »

alex

  • Community Member
  • Posts: 64
  • Hero Points: 6
Re: How to expand/collapse function with hotkey ?
« Reply #5 on: October 26, 2006, 01:13:19 pm »
If you want to know more about writing hook functions, check out http://community.slickedit.com/index.php?topic=84.0

You might find, e.g.,  the _buffer_add hook useful.

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: How to expand/collapse function with hotkey ?
« Reply #6 on: October 26, 2006, 03:50:13 pm »
Just a simple example to make life easier...
Code: [Select]
_switchbuf_selective_display(...)
{
   _str ext = get_extension(p_buf_name, false);
   switch ( ext )
   {
      case 'cpp':
      case 'c':
         show_procs ( );
         break;

      case 'h':
         hide_all_comments ( );
         break;

      default:
         break;
   }
}

Didn't check if _buffer_add_(selective_display) is also doing well.

HS2

Graeme

  • Senior Community Member
  • Posts: 2321
  • Hero Points: 305
Re: How to expand/collapse function with hotkey ?
« Reply #7 on: October 26, 2006, 10:45:04 pm »
Thanks HS2, indeed very useful to know this!
By the way, do you know if is possible to instruct SE, to open by default any file in "Selective Display" mode?


In case you didn't know, in Tools -> options -> general, if you enable the auto restore option of "selective display", slick will open a file with selective display active if that's what it had when it was closed.

Graeme

inventec

  • Community Member
  • Posts: 10
  • Hero Points: 0
Re: How to expand/collapse function with hotkey ?
« Reply #8 on: October 27, 2006, 01:03:36 am »
HS2,

So useful, thanks very much !




cmb99

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: How to expand/collapse function with hotkey ?
« Reply #9 on: January 18, 2007, 05:07:56 pm »
I can't think of another editor where you have to double-click the plus sign to expand. Also, I am very new to slickedit. How do you put the slick-c macro into the hook for default folding?

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: How to expand/collapse function with hotkey ?
« Reply #10 on: January 18, 2007, 06:07:35 pm »
If you just want to single click to expand/collapse... see the attached config screenshot.

HS2

cappy2112

  • Community Member
  • Posts: 91
  • Hero Points: 0
Re: How to expand/collapse function with hotkey ?
« Reply #11 on: January 18, 2007, 08:00:01 pm »
Bind a key to 'plusminus'.

HS2

Ive tried calling plusminus from the slick cmd line- it doesn't toggle the + or - signs
What am I doing wrong?

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: How to expand/collapse function with hotkey ?
« Reply #12 on: January 18, 2007, 08:12:56 pm »
1. 'Selective display' has to be activated first -> (+) and/or (-) signs visible on the left gutter
2. cursor sits on a line which is 'marked' with (+) or (-)

HS2

cappy2112

  • Community Member
  • Posts: 91
  • Hero Points: 0
Re: How to expand/collapse function with hotkey ?
« Reply #13 on: January 19, 2007, 01:52:49 am »
1. 'Selective display' has to be activated first -> (+) and/or (-) signs visible on the left gutter
2. cursor sits on a line which is 'marked' with (+) or (-)

HS2

I've already applied Selective Display to a file, and was wondering if there is a way to fold/unfold all, as opposed to one at a time.

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: How to expand/collapse function with hotkey ?
« Reply #14 on: January 19, 2007, 12:26:16 pm »
'show-all' on cmdline or 'View->Show All' ends selective display.

HS2