SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: Ian on August 10, 2006, 01:34:03 PM

Title: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: Ian on August 10, 2006, 01:34:03 PM
Many Windows apps and editors allow <ctrl>MouseWheelUp to increase the font size, and Down to decrease. I'm trying to do this in SlickEdit, but am a few sandwiches short of a picnic:

1. What's the trick to configuring <ctrl>Mousewheel as a hot key? I can't get the binding tool to accept it.

2. Also, in order to use a hot key, we need a function without parameters, like these (below) but only the _decrease one works. The _increase one produces visual garbage in the editor window. Can anyone tell me why please?:

#include "slick.sh"
_command void font_size_increase()
{
   wfont_zoom(+1);
}
_command void font_size_decrease()
{
   wfont_zoom(-1);
}

Thanks in advance,
Ian.
Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: gary_ash on August 10, 2006, 02:17:14 PM
I don't think slick supports that binding as an option.
I do see wheel up and down. what you may be able to do is bind the commands to the scroll events and use

if (_IsKeyDown(CTRL) )
     {
     message("CTRL is down");
     }
else
    {
     message("CTRL is not down");
     }
Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: Nathan on August 17, 2006, 09:38:45 PM
You almost got it. There are two pieces missing.

The first is that wfont_zoom() takes a string not an integer, so just quote the arguments and that part will start working:
Code: [Select]
#pragma option(strict, on)
#include 'slick.sh'

_command void font_size_increase () name_info(',')
{
   wfont_zoom('+1');
}



_command void font_size_decrease () name_info(',')
{
   wfont_zoom('-1');
}

The second is how to bind to <ctrl>Mousewheel. In the binding dialog, after pressing the 'Add key or Mouse Click ...' button, hold the control key while left clicking to activate the <ctrl> mouse button event dialog. From there you will find c-wheel-down and c-wheel-up at the bottom of the list.

Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: gary_ash on August 17, 2006, 10:44:28 PM
I don't see the c-wheel events that you're talking about on my Windows XP based SlickEdit 11.01 ???
Also do you how to set that attribute accross all of SlickEdit's buffers?

thanks
Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: Nathan on August 18, 2006, 02:02:01 PM
When you say that you don't see the c-wheel events, do you see other control-key/mouse events such as c-lbutton-down? I used XP based SE11.0.1 to write and verify the snippet of code I gave. (Cool looking effect too). XP can distinguish between left and right control buttons though, so try both.
Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: gary_ash on August 18, 2006, 03:11:56 PM
I don't see any c-... events listed at all
Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: Wanderer on August 18, 2006, 03:58:50 PM
Tools->Options->Key Bindings.
Hold down the Control key and click "Add key or mouse click"; the button's text changes, click it again.
Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: SlickEdit Support on August 18, 2006, 04:13:47 PM
And some more clarity.  (Just in case.)

1.)  Tools-->Options-->Key Bindings
2.)  Hit "Add Key or Mouse Click".  (Button label changes to " Adding...To Abort Click Here")
3.)  HOLD down the CTRL key and click ANY button/wheel/etc. on your mouse.
4.)  List of  mouse events with the Ctrl key comes up...select the event that you want- it will be prefaced with c-something.
5.)  Hit Select.
6.)  Then select the Command that you want to Bind to from the Command list.
7.)  Hit Bind and Done.

Best,
SlickEdit Support
Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: gary_ash on August 19, 2006, 03:17:58 PM
I got the c-... bindings now. I did a re-install
Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: jstoutenburg on September 21, 2006, 04:07:43 PM
I'm trying to change the edit window zoom factor, so that I can zoom in ( see large characters and less text ) or zoom out ( smaller characters, more text ).  I prefer to not  change the font size, but I can live with that, if that's the only way to implement zoom.

I'm running SE 10.0 and don't see a xfont_zoom function. Is there such a command in version 10.0 ?  Is there anyway to zoom in and out, aside from bringing up the Window Font window ?

Thanks !
Jay
Title: Re: Trying to bind <ctrl>MouseWheel to scale font size...
Post by: Nathan on September 21, 2006, 06:47:25 PM
Hey Jay,

Here's how I understand your scenario: you'd like to have, for instance, 12 point type in your editor window, and be able to zoom in to that window. However, while the fonts look bigger on the screen, they are still 12 point for printing purposes, etc.

Is that right?

Unfortunately, we only do font zooming. Maybe you could add just a little code to the example above, so that you can save and restore your print font size with the flick of a hot key.

As far as font zooming in SE 10.0, wfont_zoom is in there, and that's what you want.

Hopefully that helps!