Page 1 of 1
Cut the selectedChunk
Posted: Sat Oct 01, 2011 9:06 am
by WaltBrown
Hi! I am missing something simple.
I have "put the selectedChunk into gVariable" in an unlocked field for a mouse click which pops up a menu button.
In the menu button pick handler I put "cut gVariable". Obviously I declare gVariable in both handlers. (I cannot simply use "cut" because the field loses focus when the menu pops up).
gVariable contains "char 178 to 191 of field 1" - the field number rather than it's name.
When executed it cuts the entire field object, not the selection.
What am I missing? It's got to be something really simple, I'm just brain dead and can't find it.
Thanks, Walt
Re: Cut the selectedChunk
Posted: Sat Oct 01, 2011 9:10 am
by WaltBrown
I wonder if this is related to bug report 7766?
Re: Cut the selectedChunk
Posted: Sat Oct 01, 2011 5:14 pm
by dunbarx
Odd, indeed. How could this have gone unnoticed?
Just so you know, this works:
Code: Select all
on mouseup
put the selectedChunk into temp
do "cut" && temp
end mouseUp
I will have to see if HC exhibits the same...
Craig Newman
Re: Cut the selectedChunk
Posted: Sat Oct 01, 2011 5:32 pm
by dunbarx
Now this thing is intermiitant. I made a few fields, ran the code in several ways:
on mouseup --this never fails
cut the selectedChunk
end mouseUp
on mouseup -- this is intermiittant, field disappeared several times, but not always
put the selectedChunk into temp
cut temp
end mouseUp
on mouseup --this never fails
put the selectedChunk into temp
do "cut" && temp
end mouseUp
But now I cannot duplicate the bug at all. Everything works fine. ("I got better...") I will try a new session.
Ah. It turns out that closing and reopening a stack will cause this to happen once. Once the bug occurs, and a field is deleted, then all subsequent runs work just fine, even with new fields. I am sure we can all write scripts on preOpenStack to create a field, lose it, and then leave everything just ducky.
Craig Newman
Re: Cut the selectedChunk
Posted: Sun Oct 02, 2011 1:52 am
by WaltBrown
Craig,
The issue I had also involved a popup menu (where the "cut" is executed), and I think that changes focus, and mangles something somewhere. I can also cut from within a field's script, it's the popup which seems to mess things up.
Walt
Re: Cut the selectedChunk
Posted: Sun Oct 02, 2011 5:32 am
by dunbarx
Walt.
I put in a bug report. The way I do it is reproducable. And really odd.
# 9778.
Craig
Re: Cut the selectedChunk
Posted: Sun Oct 02, 2011 6:13 am
by marksmithhfx
WaltBrown wrote:Craig,
The issue I had also involved a popup menu (where the "cut" is executed), and I think that changes focus, and mangles something somewhere. I can also cut from within a field's script, it's the popup which seems to mess things up.
Walt
Hi Walt, I can confirm "do "cut" && gvariable" works in a popup on both Mac's and PC's. No evidence of 7766 there. I'm posting my test program.
-- Mark
PS the "cut" script is in Choice 1 on the popup
Re: Cut the selectedChunk
Posted: Tue Oct 04, 2011 4:01 am
by WaltBrown
Thanks. I guess "cut" will remain buggy if called directly. I'll remember to use the 'do "cut"' instead.
Re: Cut the selectedChunk
Posted: Tue Oct 04, 2011 4:07 am
by dunbarx
The bug is confirmed by QCC. Still hard to believe this was never noticed.
I still intend to check HC, but I don't expect to find it there.
Craig Newman