Msg box works differently than button?

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Msg box works differently than button?

Post by dunbarx » Tue May 30, 2017 8:39 pm

This has me stumped. Can't believe I never noticed it before.

Put a few words of text in a field. From a button:

Code: Select all

on mouseUp
   select word 2 of fld 1
end mouseUp
No problem, right? But if I run the same line of code from the message box, the selection flashes and does not stick.

HC does not act this way. Not sure if it has always been so in LC (v.6x and 8x).

Craig Newman
Last edited by dunbarx on Tue May 30, 2017 9:46 pm, edited 1 time in total.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Msg box works differently than button?

Post by FourthWorld » Tue May 30, 2017 8:43 pm

The LC Message Box selects its text when executed. I don't believe HC did that. Most OSes allow only one text selection at a time, so when something becomes selected any other selection becomes deselected.

What are you working on that needs this behavior in the Message Box? There may be ways to modify the Message Box to support that.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Msg box works differently than button?

Post by dunbarx » Tue May 30, 2017 9:52 pm

Richard.

Not sure I know what you mean by
selects its text when executed.
I miswrote slightly. From msg, I simply had they single line "select word 2 of fld 1". In a button, I had the full handler. So when I hit enter in msg, the selection is made, but then lost. Where does it go? What "other" selection is coming up?

Thanks for working this...

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Msg box works differently than button?

Post by FourthWorld » Tue May 30, 2017 10:15 pm

When I run a statement from the Message Box, after it's done executing that statement line is then selected in the Message Box window.

Since there can be only one active text selection at a time, once the Message Box selects its text after execution the text that the statement you had run loses its selection.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Msg box works differently than button?

Post by dunbarx » Tue May 30, 2017 10:33 pm

Ah.

Now I see what you mean, and how hacking msg might be a way around it. I do not need that at all, I was just testing.

Craig

Post Reply

Return to “Talking LiveCode”