I have a scrolling field with entries and have been reading the dictionary, but cannot seem to solve this simple task.
I am trying to move the line clicked on by the user into a field (txtTitle).
The dictionary for "clickLine" says:
If the field is locked, the clickLine function is most useful within a handler (such as mouseDown or mouseUp) that is triggered by the mouse click.
If the field is unlocked, mouseDown and mouseUp messages are not sent when the user clicks in the field (unless the user right-clicks or holds down the Control key while clicking). Use the clickLine function within a selectionChanged handler to determine what line the user is editing in an unlocked field.
Here is my "mouseUp" code
on mouseUp
set the lock of field "lbxTitle" to true
put the value of the clickLine into theLine
set the text of field "txtTitle" to theLine
set the lock of field "lbxTitle" to false
end mouseUp
When I comment out the last line and check the properties for "lbxTitle" after the mouseUp, the Lock Text box is not checked (not locked).
If I use the Ctrl key + mouse click over a line in the scrolling field, the LINE moves into the "txtTitle". This matches the dictionary for an "unlocked" field.
Thanks for the help
bill
Moving text from scrolling list to another field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Moving text from scrolling list to another field
Hi Bill,
the field must be locked before it can get a mouseUp event. So it seems that your field "lbxTitle" is not locked. There is no use in setting "the lockText" (not lock as you wrote) of the field in the mouseUp handler.
Either you right click/control click then the field will get the mouseUp handler even if unlocked, or the field has to be locked before = the lockText of the field is set to true before then there is not use to set it in mouseUp the handler.
Kind regards
Bernd
the field must be locked before it can get a mouseUp event. So it seems that your field "lbxTitle" is not locked. There is no use in setting "the lockText" (not lock as you wrote) of the field in the mouseUp handler.
Either you right click/control click then the field will get the mouseUp handler even if unlocked, or the field has to be locked before = the lockText of the field is set to true before then there is not use to set it in mouseUp the handler.
Kind regards
Bernd
Re: Moving text from scrolling list to another field
Hi.
What Bernd said.
You have the basics down pretty well: You might, however, if the field is locked, simply:
It is important to decide whether a field should be locked or not, and it generally stays put. The following is a kluge, and probably will cause more problems than it solves, but it allows the field to be unlocked and still receive mouseUp messages:
Now this is really doing it the hard way. But at least you see how it works.
If the field is unlocked, what about:
Now this is not terribly robust. In fact, it is awful. Do you see why? If you play around for a while, you should. This playing thing is important, by the way. Write back with your progress.
Craig Newman
What Bernd said.
You have the basics down pretty well: You might, however, if the field is locked, simply:
Code: Select all
on mouseup
put the value of the clickLine into fld "txtTitle"
end mouseup
Code: Select all
on mouseEnter
set the locktext of me to "true"
end mouseEnter
on mouseup
put the value of the clickLine into fld "txtTitle"
end mouseup
on mouseLeave
set the locktext of me to "false"
end mouseLeave
If the field is unlocked, what about:
Code: Select all
on openfield
put the value of the clickLine intofld "txtTitle"
end openfield
Craig Newman