User Interface Question

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: User Interface Question

Post by rumplestiltskin » Fri May 11, 2018 5:27 pm

I filed a bug report: https://quality.livecode.com/show_bug.cgi?id=21268

If you move the mouse pointer outside the stack window, LC can't find the target button (stack?) when you use the arrow keys.

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

Re: User Interface Question

Post by jmburnod » Fri May 11, 2018 6:03 pm

Hi Barry,
Congratulations
Not sure this is a bug
Maybe that was an error to use the target in this case.
Best
Jean-Marc
https://alternatic.ch

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: User Interface Question

Post by rumplestiltskin » Fri May 11, 2018 6:48 pm

jmburnod wrote:
Fri May 11, 2018 6:03 pm
Hi Barry,
Congratulations
Not sure this is a bug
Maybe that was an error to use the target in this case.
Best
Jean-Marc
Can't understand why just moving the mouse pointer outside of the stack window should result in this error. Everything was working when the pointer was within the stack window. Why would an "arrowKey left" keystroke require a mouse pointer to be in any particular location?

If I use only the mouse to initiate the popups and then move the mouse pointer outside of the stack window, I can arrow up/down to choose the item and press "Return" to finish the selection (and have the field update properly). So moving the mouse outside the window is okay in this case.

I think it's a LC bug. I'm good at finding bugs...not because I'm good but just because sh*t likes to fall on me. :lol:

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: User Interface Question

Post by rumplestiltskin » Fri May 11, 2018 9:04 pm

More enlightenment. I tried a fresh stack with a field and an option button. In the field I put an openField handler:

Code: Select all

on openField
   send mouseDown to btn "optMenu1"
end openField
What's strange is that, wherever the mouse pointer is located within the stack window, that's where the option button's choice menu pops up. When I move the mouse pointer outside the window and tab into the field (causing the openField event), the script errors.

It appears that LC insists on using the mouseLoc as the location where the menu must pop up rather than where that btn is really located.

So I can't send a "mouseDown" message to the button unless the mouse sends it (and, of course, it's then positioned in exactly the right place) but using this:

Code: Select all

on openField
   click at 200,98 -- the top edge of the popup btn peeking out from behind the field
end openField
...will work regardless of the mouseLoc. It pops down the choice menu and, using a bit of code in the button, the user's choice is placed into the field.

So I think I'm making progress. BTW, you might think "well, why not just use popup btns and the mouse?" My answer is that I'm trying to eliminate the necessity of using the mouse except for specific areas where it's either unavoidable or "better" than the keyboard. I'm re-building an app that originally ran in MS-DOS and did so without a mouse. The "tab" key moved you from field to field and the up/down arrow keys permitted the choice (when a choice was available instead of typing text).

I still think this is a bug in LC as sending a mouseUp or mouseDown to a btn should, IMHO, not involve the mouseLoc (as in, "it's off the stack window so we'll error"). I have not tested a Runtime version to see if the problem persists there.

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: User Interface Question

Post by bwmilby » Fri May 11, 2018 11:27 pm

It is not a bug. Per the dictionary:

“Use the popup keyword to create a popup menu that appears under the mouse pointer.”

So you either need to have the click occur where you want the menu or use a different type. I started experimenting with a combo box but couldn’t get it working all the way right off.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: User Interface Question

Post by rumplestiltskin » Sat May 12, 2018 12:05 am

Yep. So "Not a bug". Now that I understand it, I'll craft something with the "click at...".

Always helps to have multiple eyes and brains working on it. Appreciate everyone's efforts. I'll get the bug report closed.

Barry

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

Re: User Interface Question

Post by jmburnod » Sat May 12, 2018 9:09 am

Hi,
I'll craft something with the "click at..."
click at the loc create recursion issue
I also tried using local instead the short name of the target with same results
@ bwmilby
Use the popup keyword to create a popup menu that appears under the mouse pointer.
Yes, but "if no location is specified, the menu's top left corner is at the mouse location" (doc LC 8.1.6)
Best regards
Jean-Marc
https://alternatic.ch

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: User Interface Question

Post by jacque » Sat May 12, 2018 3:38 pm

You could track the current field and use its location as the place to pop up the menu. When the user tabs into a field you'll get an openField message. Use that to get the name of the field and pop up the button at the location of that field. This way the mouse isn't involved and the target is specified.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: User Interface Question

Post by rumplestiltskin » Sat May 12, 2018 9:12 pm

The popup command can't be used because it relies upon the mouse pointer being within the stack window. If you attempt to use it (even with a specific location where a btn is really located!) while the mouse pointer is outside the window, you either get an error:
"Message execution error:
Error description: subwindow: can't find stack or button"
(that was calling it from the Message box)
-or-, if called from the Message box with the mouse pointer -in- the message box, you'll get this:
Screen Shot 2018-05-12 at 2.05.15 PM.png
...and that's no good, as well.
I'm using "click at 200,90" (or whatever valid loc) and that seems to work although some additional UI tweaking is certainly required.
I've attached a sample stack.
Attachments
Tab&OptionBtnsViaKeyboard.livecode.zip
(1.43 KiB) Downloaded 206 times

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

Re: User Interface Question

Post by jmburnod » Sun May 13, 2018 3:50 pm

Hi Barry,
Congratulations again.
Your stack works well for me. Option menu seems be the trick
I tried to use the short name of the target and it also works.

OptionMenu button (renamed bOption1 bOption2 bOption3) script

Code: Select all

on mouseUp
   debOptionMU
end mouseUp
Flds Field1 Field2 Field3 script

Code: Select all

on focusIn
   defFieldFI
end focusIn
Card script

Code: Select all

on defFieldFI
   put char 6 to -1 of the short name of the target into tNumF
   click at the loc of btn ("bOption" & tNumF)
end defFieldFI

on debOptionMU
   put char 8 to -1 of the short name of the target into tNumF
   put the label of the target into field ("Field" & tNumF)
   set the label of the target to "1st Choices"
end debOptionMU
Best regards
Jean-Marc
https://alternatic.ch

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”