Page 1 of 1
ReturnInField listbox/group Messagepath problem [SOLVED]
Posted: Fri May 15, 2015 1:39 pm
by Lagi Pittas
Hi
I created a lookup routine using a listbox and allowed for return or doubleclick as a selection - everything worked fine.
I then wanted to do other processing that the listbox by itself couldn't do (or maybe me?) so I selected the listbox and made it a group.
I transferred all the listbox code into the group script - and it all works EXCEPT the returninfield handler is not called withingeither the group or the listbox scripts.
If I add a returninfield handler in the main stack it gets called - I would have thought it would get passed up to the group first as the next closest container, or am I missing something.
Best Regard Lagi
Re: ReturnInField listbox/group Messagepath problem
Posted: Fri May 15, 2015 2:52 pm
by dunbarx
Hi.
Not sure I have this right. If I make a new list field and place this into its script:
Code: Select all
on returninfield
put the selectedText of me
end returninfield
I get what I expect.
If I then group that field, and move the handler into the group script (note the modification required):
Code: Select all
on returninfield
put the selectedText of the target
end returninfield
All works fine. Is that small change helpful?
Craig Newman
Re: ReturnInField listbox/group Messagepath problem
Posted: Fri May 15, 2015 4:10 pm
by Lagi Pittas
Hi Craig
Thats what I did - but the Handler is never called in the Group script but gets handled in the main stack.
That's what had me stumped
Lagi
Re: ReturnInField listbox/group Messagepath problem
Posted: Fri May 15, 2015 5:29 pm
by dunbarx
If you put a breakpoint in the group script handler, it does not detect the message? I assume you deleted the handler in the field script, right?
If it is firing in the stack script, something has made the message bypass several controls.
Craig
Re: ReturnInField listbox/group Messagepath problem [SOLVED]
Posted: Sat May 16, 2015 4:16 pm
by Lagi Pittas
Hi Craig
As soon as I read your answer/question the answer flashed into my head - I am using rrpgrid from runrevplanet.com (a fantastic piece of coding btw every(commercial) livecode user should check it out you'll be glad you did - anybody who has wished the standard grid was orthogonal, consistent and obvious in the way it works - anyway I digress). I remembered that the main routine uses a rawkeydown and although the code is not in a front script, I was pretty sure rawkeydown is called before returninfield in the standard message hierarchy . I put a blank rawkeydown handler within the menu button and lo and behold the group script returninfield is called (taking precedence over the returninfield I placed within the list box).
It's all very logical after the problem has been solved.
Thanks again Craig
Regards lagi