TextArea and FocusRing ?

In a TextArea:
UseFocusRing: ON

(Try to add in the TextArea *) Three events and place the code below:

a. DragEnter
b. DragOver

// Displays the Focus Ring Me.UseFocusRing = True Me.Invalidate

c. DragExit

// Remove the Focus Ring Me.UseFocusRing = False Me.Invalidate

Run,
Select some styled text from Apple’s TextEdit,
drag the selected text above the TextAre,
Nothing (No Focus Ring).

I added (while writing this text) two new Events: GotFocus and LostFocus and filled them with the appropriate code (read above). No FocusRing while dropping a Text from Apple’s TextEdit or from the project running in the IDE (I selected some text in Apple’s TextEdit, then go to the project Main window and drag ‘n’ Drop it onto the TextArea. The TextArea is not selected (does not have the focus prior to the drag ‘n’ drop).

The iBeam cursor moves vertically accordingly to the Mouse in the drag move.

Ideas ?

BTW:
Xojo 2014r2
OS X 10.9.4

  • I do not know how I achieved that, but I put two new Events in the Window instead of in the TextArea Control. I wasted some minutes to try to duplicate the bad experience, I still do not know how to replicate that.
    Yes, it is not the first time this happens to me.

OK, I wanted to add another event, but I took my time. The first attempt, I had DropObject selected (first stade of selection): it allows me to add GotFocus. The second attempt (GotFocus was selected, first stage), and the drawer shows me that I will add an event to the window. Any successive attempts will try to add the event into the window, not the Control (TextArea).
I was able to place the LostFocus event to the TextArea when I selected the TextArea Control (still first step).
I selected the newly added LostFocus event (in the TextArea expanded view), then clicked a second time and chooses to add a new event and got the drawer telling me that I will add an event to the window.
I have done many go to Apple’s TextEdit, back to Xojo’s IDE while doing these steps. I also had Preview Open.

Nota: it seems to me, here, that it is very easy to replicate this IDE feature.

Did I told you, lately, that I feel insecure while using Xojo’s IDE ?
Yes Man !

Last check: I put user interface feedback text in GotFocus / LostFocus. All I Get is either that text OR the dropped text. Never both. To get the dropped text, I have to click in the window’s background where I have code to clears the Focus !
I will take a breakfast now because nausea comes to me.

Breakfast is going fine. I checked that project as a Standalone under Windows XP: it worked like it does on OS X (more or less).

BUT: the selected text in Wordpad disappears once the drop occurred. Strange Windows behavior (bad people will say: usual Windows behavior !): use Copy / Paste if you do not want to loos text in your documents !

The docs clearly state:

You can do this in the Open event of a TextArea:

#if TargetCocoa Declare Sub setFocusRingType Lib "AppKit" Selector "setFocusRingType:" (NSView As Ptr, type As Integer) Const NSFocusRingTypeExterior = 2 Dim scrollView As Ptr = Ptr(Me.Handle) setFocusRingType(scrollView, NSFocusRingTypeExterior) #endif
Then you’ll have a focus ring around the NSScrollView which wraps the NSTextView (which doesn’t support setFocusRingType:).

No, obviously, I do not saw that.

Thanks

[quote=118581:@Eli Ott]You can do this in the Open event of a TextArea:

#if TargetCocoa Declare Sub setFocusRingType Lib "AppKit" Selector "setFocusRingType:" (NSView As Ptr, type As Integer) Const NSFocusRingTypeExterior = 2 Dim scrollView As Ptr = Ptr(Me.Handle) setFocusRingType(scrollView, NSFocusRingTypeExterior) #endif
Then you’ll have a focus ring around the NSScrollView which wraps the NSTextView (which doesn’t support setFocusRingType:).[/quote]

Works like a charm in the Open event or in a button Action event.

BUT for what Emile wants to do happens the problem discussed at length in
https://forum.xojo.com/14202-drag-border-vs-focusring-visual-cues-and-drop-file-selected
In DragEnter, the focus ring appears only after the file has been dropped.

There were numerous experiments in the thread, none of them helping with the focus ring. I think the best workaround for a TextArea is the rectangle underneath, described in
https://forum.xojo.com/14202-drag-border-vs-focusring-visual-cues-and-drop-file-selected?search="out+of+the+box"

The advantage is that it is cross-platform.