Author Topic: Trying to bind <ctrl>MouseWheel to scale font size...  (Read 15726 times)

Ian

  • Community Member
  • Posts: 5
  • Hero Points: 1
Trying to bind <ctrl>MouseWheel to scale font size...
« 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.

Nathan

  • Community Member
  • Posts: 60
  • Hero Points: 3
Re: Trying to bind <ctrl>MouseWheel to scale font size...
« Reply #1 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.


Nathan

  • Community Member
  • Posts: 60
  • Hero Points: 3
Re: Trying to bind <ctrl>MouseWheel to scale font size...
« Reply #2 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.

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Trying to bind <ctrl>MouseWheel to scale font size...
« Reply #3 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.

SlickEdit Support

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 384
  • Hero Points: 29
Re: Trying to bind <ctrl>MouseWheel to scale font size...
« Reply #4 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

jstoutenburg

  • New Community Member
  • Posts: 1
  • Hero Points: 0
Re: Trying to bind <ctrl>MouseWheel to scale font size...
« Reply #5 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

Nathan

  • Community Member
  • Posts: 60
  • Hero Points: 3
Re: Trying to bind <ctrl>MouseWheel to scale font size...
« Reply #6 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!