Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Script UI onChange events

LEGEND ,
Nov 08, 2008 Nov 08, 2008
Hi everyone,

I'm trying to figure out if there's a way to get an onChange event to
fire when a EditText widget has its text changed progaramatically and
then loses focus.

Basically, I have an IntegerEditBox widget which has a nudge property
(thanks to Bob Stucky for most of that code). The nudging works great,
but when you change the EditText's text property, it doesn't trigger an
onChange event when the EditText loses focus. I can dispatch an onChange
event each time it's nudged, but that means an AWFUL lot of extra
processing...

Any ideas?

TIA.

--
Harbs
http://www.in-tools.com
TOPICS
Scripting
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 09, 2008 Nov 09, 2008
How 'bout setting a flag and firing the onChange event during an onBlur event?

widget.onBlur = function() {
if ( this.nudged ) {
this.onChange();
}
}

Bob
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 09, 2008 Nov 09, 2008
Hi Bob,

Thanks for the idea. I had already tried that and it didn't seem to
work. It looks to me that EditText widgets do not fire onBlur events. Am
I wrong?

--
Harbs
http://www.in-tools.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 09, 2008 Nov 09, 2008
LATEST
I just tried again and I got it to work, but in a slightly different way.

I used widget.addEventListener ('blur', blurHandler);

I had actually tied this as well, but I had put the blurHandler function
below the addEventListener which obviously didn't work...

Thanks a lot!!!

--
Harbs
http://www.in-tools.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines