Focus ring around a picture in Windows

In Windows, a canvas UseFocusRing property has no effect because Xojo does not draw a focus ring anyway.

As stated very clearly in the LR at
http://documentation.xojo.com/index.php/Canvas.UseFocusRing

[quote]If True, the Canvas indicates that it has the focus with a ring around its border; if False, the appearance of the object does not change when it has the focus.
Setting this property to True has no effect on Windows or Linux. The default is True.[/quote]

In another thread I was said that I did not know what I was talking about when I tried all so politely to state that fact. Well, I can accept being ignorant, although the formulation could have used some manners.

No matter, ignorance is easy to cure through research. And nobody should ever be shamed for that here, as we should be sharing knowledge in good intelligence, instead of making others feel bad. The mere fact that Xojo indeed never shows a Focus ring in Windows and Linux applications cannot be disputed.

But would a focus ring be possible in Windows around a canvas outside of Xojo, if for some reason that was left aside, somehow ? I tried to scour msdn for “Focus ring” and “FocusRing” but the results where all about Mac OS X :wink:

Never mind ; at courageous heart nothing impossible. So I embarked on Visual Studio VB in the hope of finding the all elusive Focus Ring a luminary once told me he knew what it was about.

In VB a PictureBox which, to my naive eyes, looks very much like a Canvas, does not seem to have a Focus property. Hence it seems very difficult to obtain the prized blue ring around it. But a button can have the focus, and does exhibit a focus ring when selected. And more interestingly, in VB, a button can contain a picture. So in no time I was able to obtain a control showing a focus ring and a picture inside. Conclusion, VS VB .NET knows not focus rings around picture boxes, but one can get roughly the same effect by using a button.

Back to Xojo, we do have buttons that can show a picture : BevelButtons. So I proceeded to adapt the project that let me discover the drag box in OS X Carbon, and dragged a file over the BevelButton. Here is the result :

Bevelbuttons have a grey focus ring, but they do have one (it is blue around a normal button). And when the cursor hovers them, they turn blue automatically, with or without a file in drag. So indeed the functionality of showing a selection when dragging a file over an area in Windows is possible, if not over a Canvas (unless by drawing a rectangle inside them).

Changing from Canvas to BevelButton may not be terribly convenient for Cross Platform applications. Another way is to draw the focus ring inside the canvas. I posted the pure Xojo code I use at Drag border vs FocusRing, visual cues and drop file selected - macOS - Xojo Programming Forum

I know, some superior minds will frown about yet another workaround. As a modest human being, I am just under the impression that coding is not about wishing for what should exist, but rather to build apps that exhibit a given behavior, would that be through less travelled paths. In other words, instead of making things impossible through dogmatism, being pragmatic enough to accept things as they are.

I am posting this in the event of a search for ‘Windows Canvas focus ring’ or something to that effect. Hope it will be of use.

I may not know what superior minds are talking about, but I am content to, sometimes, help once in a while a fellow human being get the result he wants. Courtesy and good manners included.

New to me. My memory stayed with “there is a Focus Ring under Windows”.

Also, under Windows, an icon appears at drag ‘n’ drop time when the mouse cursor is above the window, depending of the kind of data file / control in the Window (I like that). On Cocoa… nothing !

In a multimedia project, a Tab to move around the Controls on a window displays a Focus Ring around a Canvas. Nothing related to drag and drop. [OS X]

A question arise: what are things on other applications (Windows, OS X), not built with Xojo ?

Maybe we are a bit late and Focus Ring disappears from C, Java, Whatever created applications ?
Someone ?

PS: yes, I do not use so many commercial applications nowadays (beside Xojo).
But I have old (very old) licenses, many licenses, even licenses to died applications / platforms.

Around buttons, yes. Not around canvases.

I think I can help with that. A simple custom cursor ought to do. If so, I will add that in the thread https://forum.xojo.com/14202-drag-border-vs-focusring

What do you mean ? How would you do a drag and drop with the keyboard ?

[quote=115172:@Emile Schwarz]A question arise: what are things on other applications (Windows, OS X), not built with Xojo ?
[/quote]

No focus ring around a PictureBox in VB .NET (or VB6 for that matter). .NET being the current Windows framework, once can assume all languages supported by VS have the same limitation : C++ C#, Java, VB …

As I posted above, the workaround I use for Mac OS X works fine for Windows canvas as well.

As I observed in the OS X thread, Cocoa abandoned the Carbon drag border. But that is not a reason not to have one if this improves the user interface. As programmers, we have the privilege to create better user interfaces, even if regular languages do not offer the right features. A lot of UI innovations started that way. As you know since you have been using programs for as long as I do :wink:

Yes.

Emile, see https://forum.xojo.com/14202-drag-border-vs-focusring for a way to display information next to the cursor while dragging a file.