How to get the string value from NSSearchFieldMBS in MBS Plugins 25.3?

I have NSSearchFieldMBS on the window toolbar, placed like that:

var itemSearch as NSToolbarItemMBS
itemSearch=items(1)
mySearchField = new aSearchField(0, 0, 150, 20)
mySearchItem = itemSearch
itemSearch.view = mySearchField

I was using TextDidChange(fieldEditor as NSTextMBS, notification as NSNotificationMBS) event of mySearchField to handle the input:

winTasks.the_search_text=fieldEditor.Text

It worked perfectly. However, after updating the plugins to 25.3, the following error appears:

Type “Variant” has no member named “text”

How can I get the text from the NSSearchFieldMBS field (well, other than staying with the 25.2 version)? Using fieldEditor.StringValue gets me TypeMismatchException error.

OK, I am an idiot. Let this post remain as a monument to my stupidity. winTasks.the_search_text=me.StringValue is what I should use.

Making errors doesn’t make one stupid. We all make them. Regularly. It’s part of being a developer.

Times beyond counting I’ve been 100% sure something is broken and made a loud statement :loudspeaker: to a coworker or on this forum, only to realize I had misspelled something, or was using a different method than I was meant to, etc..

Mistakes are how we learn.

In my opinion doing anything (writing software, knitting a sweater, cooking a stew) which requires effort and experimentation is pretty damn impressive, so…

I say kudos to you, and all of us on this forum trying to make our little mental constructs “go” and “do”. :nerd_face:

Anthony

I’m extremely concerned that me in an event handler is somehow a Variant. I can’t fathom how that’s possible. Ping @Christian_Schmitz @Javier_Menendez teach me something new or tell me something’s broken – because this thread is unsettling.

Update: Figured it out. StringValue is a property of NSSearchFieldMBS’s super, NSControlMBS, it just happens to look like Variant.StringValue. Monkeybread Xojo plugin - NSSearchFieldMBS class

1 Like