Popup menu & menuhistory & VERY ODD

dunbarx at aol.com dunbarx at aol.com
Thu Apr 21 10:24:55 EDT 2011


It seems like there should be an easy way to do this, but I cannot find it. I made an ugly workaround with a two buttons. I'm sure you can modify it to make your data entry field do the same thing. With a popup button ("yourPopUpButton") and an action button, try this in the action button script:



on mousedown
   popup btn "yourPopUpButton"
end mousedown


on mouseup
      set the screenmouseLoc to (item 1 of the loc of me + 125 & "," & item 1 of the loc of me + 195)
end mouseup



Note that the screenMouseLoc is a property, whereas the mouseLoc is a function. You will have to modify this in your own stack to account for relative placement of the objects in question. Play around with the coordinates.


I don't know why there isn't a property for this in local window terms, as opposed to a function. I hear that setting the loc of the cursor is considered dicey in UI terms.


Anyway, if you set the numbers up correctly, you can see that when clicking on the action button, a menuItem from the popup will be selected.


Now for the weird stuff. THE MOUSE NEED NOT BE RELEASED for this to work.  The mouseUp message should never be sent. So how do it know?  If the mouseUp handler is commented out, the location of the cursor is not set, Jacques, I need an aspirin.


Anyone? This baffles me, even though it works fine.


Craig Newman




-----Original Message-----
From: Marty Knapp <martyknapp at comcast.net>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Thu, Apr 21, 2011 12:19 am
Subject: Popup menu & menuhistory


I have a field that I've configured to display a popup menu using a hidden popup menu button. If a user starts to type into this field, I use a type-ahead routine that grabs its guess from the menu items in the button. Is there a way to set this up so that if they type something, then click for the popup menu, for the menu to pop up at the line where this text is found (like in an option menu)? Setting the menuhistory doesn't seem to work. 
 
Thanks for any help, 
Marty Knapp 
 
_______________________________________________ 
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