Msg box still dicey?

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

Msg box still dicey?

Post by dunbarx » Fri Nov 01, 2019 5:59 pm

I know this has been discussed before, that there are peculiarities with msg.

For example, in a card with one button and one editable field, if, in the button script:

Code: Select all

on mouseUp
   focus on fld 1
end mouseUp
I get a blinking cursor in the field. But the same command from msg does nothing at all. Still that sort of behavior? LC 9.04

Craig

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Msg box still dicey?

Post by jmburnod » Fri Nov 01, 2019 6:18 pm

Hi Craig,
Same result with LC 9,5.0.
In this case LC is smarter than i tought. LC is able to keep the last position of cursor after a click outside field 8)
Best
Jean-Marc
https://alternatic.ch

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

Re: Msg box still dicey?

Post by dunbarx » Fri Nov 01, 2019 6:53 pm

Jean-Marc.

That is indeed cool, and actually is mentioned in the dictionary.

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Msg box still dicey?

Post by bogs » Fri Nov 01, 2019 8:17 pm

dunbarx wrote:
Fri Nov 01, 2019 5:59 pm
But the same command from msg does nothing at all. Still that sort of behavior? LC 9.04
Well, it does something on 'nix in 9.5, when I run that from the message box, it briefly focuses the field before it ultimately focuses the tools palette :P
ksnip_I need some focus here.png
I just can't seem to focus...
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Msg box still dicey?

Post by [-hh] » Fri Nov 01, 2019 10:48 pm

@Craig. The message box is set to get focus after issuing a command if it is visible.
So it is a possible way to first hide it in order to loose that 'superior' focus.

Code: Select all

hide msg; focus on fld 2 -- this works
@bogs. The repeated selection of the tools palette is an old unix bug.
shiftLock happens

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Msg box still dicey?

Post by bogs » Fri Nov 01, 2019 11:02 pm

[-hh] wrote:
Fri Nov 01, 2019 10:48 pm
@bogs. The repeated selection of the tools palette is an old unix bug.
It could be, but I wasn't able to reproduce it on this box in 6 - 7.x versions of Lc, using 'focus on field 1' from the message box actually put the focus on the field but then returned it to the message box in those versions.

In 2.2, the message box simply reports 'no such object', but doesn't loose focus itself.

In Mc 2.2 (Starter Kit), it simply sets the focus to the field as it might be expected to do.
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Msg box still dicey?

Post by [-hh] » Fri Nov 01, 2019 11:45 pm

In my wording every LC version < 8.1.10 is "zombie" and every other version < latest (currently 9.0.5/9.5.0) is "old" ;-)
shiftLock happens

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Msg box still dicey?

Post by bogs » Sat Nov 02, 2019 12:55 am

Ah I see. In my world view, it runs like this (more or less)
Mc -> RR 2.x_____ my place (current old)
Lc 6.x -> 7.x______pinnacle of stability (current stable)
Lc 8.x ->_________Huh, never saw it do that before (current beta)

* DIsclaimer - YMMV, a watched pot never boils, a bird in the hand is worth 2 in the bush, etc etc etc.
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Msg box still dicey?

Post by richmond62 » Sat Nov 02, 2019 2:10 pm

I think that you will find that putting this in the Message Box works:

Code: Select all

select after fld 1

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

Re: Msg box still dicey?

Post by dunbarx » Sun Nov 03, 2019 1:21 am

Richmond.
select after fld 1
That has always worked. Msg seems to "get" more narrowly defined instructions, like "after", but "focus" is what I was asking about. This because the dictionary says quite clearly what this command should do to a field. Doing so from, say, a button script works just fine.

Craig

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

Re: Msg box still dicey?

Post by FourthWorld » Sun Nov 03, 2019 2:42 am

dunbarx wrote:
Sun Nov 03, 2019 1:21 am
select after fld 1
That has always worked. Msg seems to "get" more narrowly defined instructions, like "after", but "focus" is what I was asking about. This because the dictionary says quite clearly what this command should do to a field. Doing so from, say, a button script works just fine.
A button has no selectable text.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Msg box still dicey?

Post by bogs » Sun Nov 03, 2019 3:20 am

Um, he is saying that it works from the script of a button, not from the text of a button heh. Further, since it works from the script of a button, it should then work in the message box, but alas it does not (unless your in Mc like myself).
Image

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

Re: Msg box still dicey?

Post by FourthWorld » Sun Nov 03, 2019 7:06 am

Distinction I was drawing was that the Message Box contains an editable field, and will often refocus itself for further command entry, evidently.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Msg box still dicey?

Post by bogs » Sun Nov 03, 2019 12:46 pm

Ah I see, sorry I completely missed that one, but I am a bit under the weather at the moment and a little more obtuse than usual.

It is curious, though, that even though Mc's message box is the same, it doesn't do the same, i.e. return focus to the field issuing the command entry.

In fact, here on 'nix, it doesn't return focus to the message box either, least not on XFCE. Focus ultimately winds up at the tool palette, which of all the choices is the most bizarre. I need to test it out on MATE, since I know 8.x and up give weird results on XFCE anyhow for even the most common place expectations.

As Hermann said, a bug for 'nix, so might it not be a bug all the way around? In other words, something has changed from (what I consider) the expected behavior to the unexpected behavior of either focusing the tool palette or returning focus to the mb on other OS'es. If it is different on 2 OS'es in an environment that is supposed to be the same on all, that sounds bug like.

*Edit - In my previous experiment, I was using the Mc IDE with the Mc engine. To see if it were the engine producing the difference in the result, I switched to Mc IDE + Lc 6.7.11 engine. The result was the same as using the Mc engine ( Field got the focus, not the msgbox), so I can only assume at that point that changes were made in the scripts governing the msgbox field, if Richard's theory is correct.

*Edit 2 - in playing with this across multiple versions/desktops, I've actually come to the conclusion that the way Richard explains it is in fact the way it should be working *because* I can see that the field does get focus after the command executes, so the command itself is working as the dictionary states it should be, but as he points out, when your in the message box, you expect to issue more commands following the one to set focus, unlike when you execute a script from a button, where you expect that the code is (more or less) finalized.

Side edit - In MATE, focus does not switch to the tools palette, testing for me is finished :P

Picture demonstrating that the field *is* actually focused after the command is issued -
ksnip_focusedField.png
It is hard to keep focus....
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Msg box still dicey?

Post by richmond62 » Sun Nov 03, 2019 2:37 pm

That has always worked.
Then the sensible thing might be to use 'that.' :D

Post Reply

Return to “Talking LiveCode”