SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: alex on August 31, 2006, 06:02:20 pm

Title: Which form do I need to change to change default size of new windows?
Post by: alex on August 31, 2006, 06:02:20 pm
I know about the ctrl-shift-space trick for bringing up the form editor for the current form, but I can't  figure out how to make this work for the edit window (by which I mean, the windows that are used for most of the text editing in SlickEdit).  I assume that there's some way of getting at the default form and resizing the way new windows open (for me, they're way too wide and short).  Is this not possible?  Is there another way to do this?
Title: Re: Which form do I need to change to change default size of new windows?
Post by: Graeme on September 01, 2006, 06:37:02 am

Most likely there's no form for it coz it's just an empty window.  Do you need to have multiple windows?  In case you didn't know, on the General tab of General Options you can uncheck "one file per window" to get just a single window.

If you're going to stick with multiple windows I doubt if you can change the initial default size but you can probably write a macro to set the active window to a particular position and size more quickly than dragging.  In the restore.e file in slick macro folder you can see the function save-window-config call write-window-data.  write-window-data calls _MDIChildGetWindow to get width, height and x,y  - hence you could write a macro that first calls _MDIChildGetWindow, then calls _MDIChildSetWindow with new values for width height and perhaps x,y.  You would need to experiment to see if this would work.
e.g. (untested)

Code: [Select]
_command set_new_window_size()
{
    int x=0, y=0, width=0, height=0, icon_x=0, icon_y=0;
   _MDIChildGetWindow(x,y,width,height,'N',icon_x,icon_y);
   //say(x :+ ' ' :+ y :+ ' ' :+ width :+ ' ' :+ height);
   _MDIChildSetWindow(x,y,300,500,'N',icon_x,icon_y);
   // or perhaps the previous line should be as follows
   //_MDIChildSetWindow(x,y,300,500);
}

"say" is a debug function that will output the string to a debug window if you want to see the values.
You can bind your macro to a key or toolbar button to make resizing the window slightly faster than dragging.
width and height aren't necessarily in pixels.

Graeme

Title: Re: Which form do I need to change to change default size of new windows?
Post by: Graeme on September 01, 2006, 07:48:01 am

BTW - if you name your macro _buffer_add_set_new_window_size it'll get called whenever you open a new buffer - the _buffer_add prefix in the name has special meaning.

Graeme
Title: Re: Which form do I need to change to change default size of new windows?
Post by: alex on September 01, 2006, 12:00:23 pm
Hi Graeme, I do want multiple windows--our code is narrow and tall, so I prefer to have windows side by side.   ;)

Anyway, your post was very helpful--thank you!  I found the _add_buffer_ trick in conjunction with a few macros that we had already to work perfectly once I realized that I needed to remove "_command" since the _add_buffer_ invocation took place on for procedures and not commands (or something like that).  And I even learned a useful new trick when exploring--grep for call_list :)