ANN: PopUp Menu with Key-Combination Shortcuts

zryip theSlug zryip.theslug at gmail.com
Wed Apr 21 16:47:00 EDT 2010


2010/4/21 Roger Guay <irog at mac.com>:
> I just uploaded a stack to Rev Online that shows a rather simple (I didn't say elegant) way to make popup menus with key-combination shortcuts. Just look for "Popup Menu w Shortcuts". I would appreciate any improvement suggestions.
>
> Thanks and cheers,
> Roger Guay

Hi Roger,

Interesting demo, thanks for sharing ;)

Instead of the repeat loop to look for the correct item:

on controlKeyDown theKey
   set itemdelimiter to tab

repeat for the number of lines of btn "popupMenu" -- Menu items are
the "lines" of the Popup btn
   add 1 to theNum
   if last char of line theNum of btn "popupMenu" = theKey then \
   put item 1 of line theNum of btn "PopupMenu"  into fld "Rfld"
end repeat

   pass controlKeyDown
end controlKeyDown


You may use the lineOffset function like this:

 get lineOffset("ctrl+" & theKey,btn "popupMenu")
 if (it is 0) then
      put "Nothing" into fld "Rfld"
 else
      put item 1 of line it of btn "PopupMenu"  into fld "Rfld"
 end if

Just a suggestion to facilitate the work of Revolution ;)


Regards,
-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc



More information about the use-livecode mailing list