SOLVED on FocusIn not working
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
SOLVED on FocusIn not working
Trying to run some code when i click on a text field. Currently "on textChanged" works but i also want to do something when i simply click on the field. "on mouseUp" and "on mouseRelease" doesnt work.I'im assuming because its text isnt locked and its focusable.
SOLVED---
On openField works
SOLVED---
On openField works
Last edited by Da_Elf on Sat Dec 30, 2017 6:27 pm, edited 2 times in total.
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: on FocusIn not working
MouseRelease is sent when the user releases the mouse outside the control that was clicked. Is that what you want?
Very possible.I'im assuming because its text isnt locked and its focusable.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: on FocusIn not working
No, i just want that when i click on a field it runs something. but when you type it does something else
so it has to have a handler for on textChanged as well as some sort of mouseUp or something for when i click in the field
so it has to have a handler for on textChanged as well as some sort of mouseUp or something for when i click in the field
Re: on FocusIn not working
So many handlers so little time. found it. i was looking at mouse in the dictionary. i found what i needed under field
On openField works
On openField works
Re: on FocusIn not working
Since mouse-events** are not registered in fields, maybe an "openfield" handler will do?
**Except right-click e.g. to display a popup menu or something.
**Except right-click e.g. to display a popup menu or something.
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: SOLVED on FocusIn not working
In an unlocked field, the only message sent is "openField", and only when the field gains focus. That means that if you click on a field you will get that message. But you will not get it again unless you leave the field, click somewhere else (focus on something else) and click back. So you cannot log successive mouseClicks.
Dare I suggest something like this (in the card script:
Aw, why not?
Craig Newman
Dare I suggest something like this (in the card script:
Code: Select all
on idle
if the mouse is down then put the seconds
end idle
Craig Newman
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: SOLVED on FocusIn not working
Type putting this in the fld.
Code: Select all
on mouseUp pButtonNumber
if the optionKey is down then
answer "Fred"
else
answer "Wilma"
end if
end mouseUp
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: SOLVED on FocusIn not working
MouseUp is not sent in an unlocked field.Type putting this in the fld.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 7214
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: SOLVED on FocusIn not working
See if selectionChanged does what you want.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: SOLVED on FocusIn not working
Jacque's idea might handle nearly all your needs. It will not do much if the user clicks in the same place multiple times, though.See if selectionChanged does what you want.
Craig
Re: SOLVED on FocusIn not working
using on openField worked but now i want something to happen when i close field but its not working
the field is focusable and text not locked
i want that when you click on the field you have the option of typing with a keyboard or using my own on screen keyboard which can be accessed by a little keyboard icon that pops up next to the selected field but i cant get the keyboard icon to go away when you focus out of the field
the field is focusable and text not locked
i want that when you click on the field you have the option of typing with a keyboard or using my own on screen keyboard which can be accessed by a little keyboard icon that pops up next to the selected field but i cant get the keyboard icon to go away when you focus out of the field
Code: Select all
on openField
set visible of img "onScreenKeyboard" of the owner of me to true
end openField
on textChanged
if (the length of me > 12) or (the number of lines of me > 1) then
delete the last char of me
end if
end textChanged
on closeField
set visible of img "onScreenKeyboard" of the owner of me to false
end closeField
-
- VIP Livecode Opensource Backer
- Posts: 7214
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: SOLVED on FocusIn not working
Try adding an exitField handler:
Code: Select all
on exitField
closeField
end exitField
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: SOLVED on FocusIn not working
whoohoo. it works. They had something about erasing changes to the field so i didnt think it was what i needed.