May 06, 2024, 04:32:19 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Richedit question. CTRL+mouse wheel zooming.

Started by Alyce, November 19, 2008, 03:13:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Alyce

One can hit the CTRL key and scroll with the middle mouse wheel and cause the text in a richedit control to zoom in or out. This is a problem in my app.

I want to disable this ability, or find a way to know when such an event has happened, or find a way to know how large the character size has become.

I've searched the forum. I've searched MSDN. I've succeeded... in confusing myself and giving myself a headache.

If you want to see this in action, just try Paul's richedit demo that comes with ebasic. Run it, type something, then hit CTRL and scroll the mouse wheel. (At least it zooms for me in Vista.)

Ideas? Comments?
-Alyce

sapero

Subclassing is your friend :)
sub RicheditWndProc(HWND hwnd,UINT uMsg, WPARAM wParam, LPARAM lParam),LRESULT

if (uMsg = WM_MOUSEWHEEL)
if (wParam & MK_CONTROL) then return 0
endif

Alyce

November 20, 2008, 04:31:14 AM #2 Last Edit: November 20, 2008, 04:33:14 AM by Alyce
Thank you. I'd hoped to avoid subclassing, since there is a lot going on in that poor, little richedit control. I'll see if I can integrate it.

Thanks very much, Sapero.

Edited to add: This has been downloaded six times before I got here. Apparently, others want the answer to this as well!
-Alyce

aurelCB


LarryMc

Quote from: aurelCB on November 20, 2008, 05:29:52 AM
My problem is where i can find windowssdk.inc
Click on the link at the bottom of any of Sapero's post.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

aurelCB

Yes i download latest headers and i recive this:

Compiling...
richedit_nozoom.eba
File: D:\richedit_nozoom\richedit_nozoom.eba (38) syntax error - =
File: D:\richedit_nozoom\richedit_nozoom.eba (149) unexpected end of file: missing ENDSUB
Error(s) in compiling D:\richedit_nozoom\richedit_nozoom.eba

Very weird?

Ionic Wind Support Team

AurelCB,
You need the latest version of Emergence BASIC to use this.  The code uses features added in 1.65

You can try the demo version, if you haven't already used up the 15 day trial period.

Paul.
Ionic Wind Support Team

Alyce

I've found a way to do exactly as Sapero does with API calls, but using the OnControl statement. In the ZoomCheck sub, I check for the mousewheel message, and if that is in effect, see if the ctrl key is down.


OnControl d1,1,@ENMSGFILTER,&ZoomCheck

It's a little backwards from the way I'm used to doing callbacks, though.

Sapero's code, using API subclassing:
if (uMsg = WM_MOUSEWHEEL)
if (wParam & MK_CONTROL) then return 0
endif


The API method requires a return value of 0 to stop the window from processing the message further. (I'm used to doing it this way.)

The OnControl method looks like this, and requires a return value of 1 to stop the window from doing further processing:


IF mf.msg = WM_MOUSEWHEEL
if (mf.wparam & 11) then return 1
ENDIF


It appears to work just fine and it traps the abilty of the user to zoom text in a richedit control.
-Alyce

aurelCB

Ups i forget this that i need latest version!
Ok !