Problem transferring focus to another object

dunbarx at aol.com dunbarx at aol.com
Tue Feb 15 09:55:06 EST 2011


Hi.


I am not exactly sure what you need, but I do something similar. I have a locked field "class" where I want to place one of several text options. I have an option button "class" that I reveal wherever I click the mouse down in the field. That button appears at the mouseLoc and I can then select something from it. The selected text is loaded into the proper line of the field. The button disappears. In the field script:




on mouseDown
   set the loc of btn "class" to the clickLoc
   put  item 2 of the loc of btn "class" into tLoc
   put trunc((tLoc - the top of me) / the textHeight of me) + 1 into tLine
   set the clickedLine of me to tLine --remember the line of recent interest
end mouseDown


on mouseUp
      show btn "class" at the clickLoc
      click at the loc of btn "class"
end mouseUp





And in the option button script:



on menuPick pItemName
   put  the clickedLine of fld "class" into tLine
   put pItemname into line tLine  of fld "class"
   hide me
end menuPick


on mouseRelease
  hide me
end mouseRelease



Works fine.


Craig Newman




-----Original Message-----
From: Peter Brigham MD <pmbrig at gmail.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, Feb 15, 2011 7:56 am
Subject: Re: Problem transferring focus to another object


On Feb 14, 2011, at 8:24 PM, Terry Judd wrote: 
 
> Hi there - I’m trying to build a ‘fake’ optionmenu control where the > menu is 
> a list field object that is popped up over the control. I have a > mouseMove 
> handler in the field to set the hilitedLines of the field and this > all works 
> well provided the user clicks the control to popup the menu (field) > and 
> releases the mouse before selecting an option. However, if the mouse > is held 
> down then the focus stays with the control and there doesn’t seem to > be any 
> way to hand it over to the menu (field). 
> 
> Any suggestions? 
 
Try grouping the control and the list field and putting the mousemove handler into the group script? 
 
-- Peter 
 
Peter M. Brigham 
pmbrig at gmail.com 
http://home.comcast.net/~pmbrig 
 
 
_______________________________________________ 
use-livecode mailing list 
use-livecode at lists.runrev.com 
Please visit this url to subscribe, unsubscribe and manage your subscription preferences: 
http://lists.runrev.com/mailman/listinfo/use-livecode 

 



More information about the use-livecode mailing list