Something about the message box has changed in version 8?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Timothy
Posts: 78
Joined: Tue Apr 11, 2006 7:38 pm

Something about the message box has changed in version 8?

Post by Timothy » Tue Jul 05, 2016 7:53 pm

Howdy,

This ancient script has worked fine for many years, up through the last version of LiveCode 7. It's just a quick and dirty way of searching for text in a stack.

It stopped working in version 8. I assume something has changed. I tried looking through "what's new" in version 8, came up empty.

I don't need a lot of handholding, just a clue or a hint, or possibly a kick in the butt.

Thanks in advance.

Code: Select all

on mouseUp
  go to cd "Single Line" of stack "Message Box"
    put "find " & quote & quote into fld "Message Field"  of cd "Single Line" of stack "Message Box"
    put " select char 7 to 6 of fld " & quote & "Message Field"  & quote & " of cd " & quote & "Single Line" & quote & / 
" of stack " & quote & "Message Box" & quote into tCmd
    send tCmd to me in 30 ticks
end mouseUp
It's better to be happy and rich than poor and sad -- W. C. Fields

Timothy
Posts: 78
Joined: Tue Apr 11, 2006 7:38 pm

Re: Something about the message box has changed in version 8

Post by Timothy » Tue Jul 05, 2016 9:19 pm

Me, the OP, replying to myself, to clarify.

The script opens the msg box, puts the cursor between two quotes, so I just type the word or string I want to search for and hit return.

The error message in version 8 is "Chunk: No such object, char 1" I think it's referring to

Code: Select all

fld "Message Field" of cd "Single Line" of stack "Message Box"
Apparently the field or card or stack no longer exists in version 8. I'm assuming this is a change or a new feature, though I guess it could be a bug.

Thanks in advance.
It's better to be happy and rich than poor and sad -- W. C. Fields

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Something about the message box has changed in version 8

Post by FourthWorld » Tue Jul 05, 2016 9:38 pm

If you have a GUI to trigger the Message Box to trigger the find, why not just trigger the find directly in your GUI?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Something about the message box has changed in version 8

Post by Klaus » Tue Jul 05, 2016 9:42 pm

Hi Timothy,

yep, the name of that namely field is now only -> message

To verify, I did this:
Open the "Project Browser", select "Show IDE stacks in lists" in menu "View"
and then you can inspect all th LC IDE stacks by yourself.


Best

Klaus

Timothy
Posts: 78
Joined: Tue Apr 11, 2006 7:38 pm

Re: Something about the message box has changed in version 8

Post by Timothy » Tue Jul 05, 2016 11:27 pm

Thanks, Klaus,

I changed the field name from

Code: Select all

field "message field"
to

Code: Select all

field "message"
The script works now. Is this change documented? If not, I suppose it should be.

Richard, I appreciate your efforts. You're so good at this that you don't understand how bad I am at it. I know what GUI stands for, but otherwise don't quite understand your comment, though I have no doubt it is correct. In any case, the script works now.

Tim Miller
It's better to be happy and rich than poor and sad -- W. C. Fields

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Something about the message box has changed in version 8

Post by FourthWorld » Tue Jul 05, 2016 11:31 pm

What I was thinking is that since you wrote a tool to put together a string to run the find command in the Message Box, why not just run the find command from your tool?

You could have a field to enter the search term, and an enterInField message handler to run the script. If you set the defaultStack to the topstack before running the find command your result should be pretty much what you'd get with the Message Box, but you'd no longer need the Message Box.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Timothy
Posts: 78
Joined: Tue Apr 11, 2006 7:38 pm

Re: Something about the message box has changed in version 8

Post by Timothy » Wed Jul 06, 2016 12:01 am

Oh, I get it now! Good idea, I'll probably try that.
It's better to be happy and rich than poor and sad -- W. C. Fields

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Something about the message box has changed in version 8

Post by FourthWorld » Wed Jul 06, 2016 1:31 am

If you get really adventurous and want to explore beyond the practical into the realm of "Ooh, this is fun!", you can even replace the Message Box with anything you like by setting the revMessageBoxRedirect global property to the long ID of any field.

That won't automatically handle executing commands from it (you're on your own for that, but the tip in my previous post will help get you started). But it will use the specified field to display any "put" output.

Most folks will live happy and productive lives without ever using revMessageBoxRedirect, but if you ever wanted to make a drop-in replacement for the Message Box at least now you know how to get started down that dark time-consuming road. :)

Sometimes even unnecessary things can be fun. I use a custom plugin for my Message Box that works kinda like a Linux terminal, mostly because I wanted to see if I'd like using something like that (turns out I do). I've only met one other person who enjoys it, but the main point is LC is flexible enough to do some pretty weird things if you find yourself with some extra time on your hands.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Timothy
Posts: 78
Joined: Tue Apr 11, 2006 7:38 pm

Re: Something about the message box has changed in version 8

Post by Timothy » Wed Jul 06, 2016 3:01 am

FourthWorld wrote:If you get really adventurous and want to explore beyond the practical into the realm of "Ooh, this is fun!", you can even replace the Message Box with anything you like by setting the revMessageBoxRedirect global property to the long ID of any field.
I appreciate you, Richard.

Tim
It's better to be happy and rich than poor and sad -- W. C. Fields

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Something about the message box has changed in version 8

Post by jacque » Wed Jul 06, 2016 5:32 pm

can even replace the Message Box with anything you like by setting the revMessageBoxRedirect global property to the long ID of any field.
Do you know if this works in mobile now? I admit I haven't tried it in some years, but the last time I did, it failed there.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Something about the message box has changed in version 8

Post by FourthWorld » Wed Jul 06, 2016 7:05 pm

revMessageBoxRedirect doesn't work in any standalone. It was added to the development engine many years ago to prevent crashes that were occurring with some exploratory builds of the MC IDE we were toying with. Might be kinda nice to have in standalones, though. If I ever need it I'll drop a feature request to extend it for standalones.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply