Canvas1.MouseDown’s set focus ?

Both lines below do not works all the time, but issuing some Tabs from the Keyboard do:

Self.Focus = Me Me.SetFocus

I had enought to have to press the Tab key to set the focus to a particular Canvas, then I checked it’s MouseDown Event and discovered I already set code to achive that goad (Me.SetFocus). So, I commented the line and used Self.Focus = Me that failed too.
But, the Event is fired (I set a breakpoint…)

That MouseDown ends with Return True (I use the MouseDrag Event)

Used OS: El Capitan

Maybe I’m just dense but this makes no sense to me. It sounds like you’re trying to have a canvas set the focus to itself. Why? Wouldn’t it already have to have the focus for its MouseDown event to be processed? If some other control has the focus, the call to set the focus to the canvas should be in the control that has the focus at the time.

issuing tabs from the keyboard generally moves the focus from one control to the next. When it gets to the canvas, the canvas gets the focus.

What is it exactly that you are trying to do?

Hi Dale,

simple explanation:

the window have some Controls, notably three Canvas… and I can copy / paste in (from) all of the three, thus the Focus to be set.

Canvas a: Template
Canvas b: a sticker
Canvas c: the result (merge) of Canvasa + Canvas b.

Canvas a: can receive a Paste / Drag from Finder (or another application), Open…
Canvas b: can receive a Paste / Drag from Finder (or another application), Open…
Canvas c: probably the same as a and b, but usually Copy the result.

I also have two CheckBox (for preferences), a TextField used as visual feedback (sensitive user help).

In the debug stage, I have to set the focus intensively to Canvas b and c (Copy / Drag *)

Edit --> Paste: pasgte the image (if any) in the Clipboard in the Canvas who have the Focus… [The important information.]

  • Canvas c: it usually is a reduced representation of the final image (who is always larger/taller than what is displayed: drag and drop is a second build (in MouseDrag).

I have little memory of how the program design is: I am actually debugging the resize / results when the image(s) are Landscape instead of Portrait. The project is far complex than what I wrote, but the MouseDown --> Set Focus part is here.

So, if I understand correctly, you are needing a way for the particular canvas to have or get the focus when you access it through the mouse, either to drop a picture on it or to copy/drag the picture from it. If that’s all you are looking for, try putting the me.SetFocus in the MouseEnter event.

Beyond that, since I don’t have a Mac to test it on I can’t help determine if it is a difference in the behavior of the platforms.