Author Topic: How to expand/collapse function with hotkey ?  (Read 17071 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: 2761
  • Hero Points: 292
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: 285
  • Hero Points: 24
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: 2812
  • Hero Points: 347
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: 2761
  • Hero Points: 292
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: 2812
  • Hero Points: 347
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: 2761
  • Hero Points: 292
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: 2761
  • Hero Points: 292
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: 2761
  • Hero Points: 292
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