AW: How to access the text of an option btn before menuPick?

Tiemo Hollmann TB toolbook at kestner.de
Fri Oct 9 10:53:25 EDT 2015


Thanks fort he idea Peter
Tiemo

-----Ursprüngliche Nachricht-----
Von: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] Im Auftrag
von Peter M. Brigham
Gesendet: Freitag, 9. Oktober 2015 16:32
An: How to use LiveCode <use-livecode at lists.runrev.com>
Betreff: Re: How to access the text of an option btn before menuPick?

One solution that I use is a home-made popup list. It takes 10 minutes of
set-up but once you have it in place you can call this function on mouseup
anywhere you want it. The basic idea is to have a separate popup button in
your stack (invisible) that is loaded on the fly then shown with a "popup
btn xxx" command. See below.

Can be used for right-click contextual menus too. Anywhere.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig

-------

function popChoose
   -- popChoose() is the equivalent of the "answer" command, but for a
pop-up list
   -- pops up a list of options, returns the option chosen by the user,
   --    if no option chosen, exits to top
   -- you must have a button "contextualMenu"
   --    button style = menu, menumode = popup, name = "contextualMenu"
   --    the button should be placed in your mainstack or a library stack
   --    button can be made invisible when you're done, if you like
   -- the button script needs only one handler:
   --    on menupick what
   --       set the uSelection of me to what
   --    end menupick
   -- paste this handler into a suitable stack script, so it's available
anywhere
   --    could be the same stack the button is in, but that's not necessary
   -- enter the short name of the stack containing the button
   --    into the constant declaration below
   
   -- popChoose() can accept a cr-delimited list of choices
   --    or a comma-delimited list
   -- eg: put "parsley" & cr & "sage" & cr & "rosemary" into choiceList
   --     put popChoose(choiceList) into userChoice
   -- or: put popChoose(choice1,choice2,choice3) into userChoice
   -- or: put popChoose("parsley","sage","rosemary","-","thyme") \
      --           into userChoice
   -- if you need the line number of the chosen item, check the dialogdata
   --    after calling popChoose()
   -- by Peter M. Brigham, pmbrig at gmail.com — freeware
   
   constant popChooseStackName = "yourLibraryStack"
   
   repeat with n = 1 to paramcount()
      put param(n) & cr after tList
   end repeat
   delete char -1 of tList
   put empty into u
   set the uSelection of btn "contextualMenu" of stack popChooseStackName to
empty
   put tList into btn "contextualMenu" of stack popChooseStackName
   popup btn "contextualMenu" of stack popChooseStackName
   put the menuhistory of btn "contextualMenu" of stack popChooseStackName \
         into lineNbr
   put the uSelection of btn "contextualMenu" of stack popChooseStackName
into u
   set the uSelection of btn "contextualMenu" of stack popChooseStackName to
empty
   put empty into btn "contextualMenu" of stack popChooseStackName
   -- belt and suspenders, don't leave contents hanging around
   select empty
   if u = empty then
      exit to top
      -- ie, mouseRelease, no action
   end if
   set the dialogdata to lineNbr
   return u
end popChoose


On Oct 9, 2015, at 9:51 AM, Tiemo Hollmann TB wrote:

> Hi Craig,
> 
> I don't want to display the full text of the option button, but only 
> one line of the text while hovering the text (or right click 
> buttonDown on a single line), so that the user can see, what he would 
> choose, if he clicks any line.
> I think my problem is that "the hilitedline" works only with fields 
> and not with the text of an option button, as far as I see it.
> Thank you
> Tiemo
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] Im 
> Auftrag von dunbarx at aol.com
> Gesendet: Freitag, 9. Oktober 2015 15:00
> An: use-livecode at lists.runrev.com
> Betreff: Re: How to access the text of an option btn before menuPick?
> 
> Why not set the toolTip to the text of the button? I don't know how 
> large a display that would be, or whether that format would be tenable.
> 
> 
> You could always use the "mouseWithin" message to display a field, 
> offset a bit from the combo. and display the text of the button. At 
> least you can control the properties of the field.
> 
> 
> Craig Newman
> 
> 
> 
> -----Original Message-----
> From: Tiemo Hollmann TB <toolbook at kestner.de>
> To: LiveCode User Liste senden <use-livecode at lists.runrev.com>
> Sent: Fri, Oct 9, 2015 8:50 am
> Subject: How to access the text of an option btn before menuPick?
> 
> 
> Hello,
> 
> I have an option button with long text lines as options, but the 
> button itself is smaller (width) as the text lines (because of layout 
> restrictions), so that you can't read the full text of the options.
> 
> Now I would like to find any solution to show the user the full 
> content of the text lines before he clicks any choice. Either by 
> hovering or right click or anything else I would like to put the line 
> into the tooltip or anything else. By now I failed to grab the hilitedLine
of the option menu.
> 
> Any idea how to access the text by hovering or right click?
> 
> Thanks
> 
> Tiemo
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 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
> 
> 
> _______________________________________________
> 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
> 
> 
> _______________________________________________
> 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


_______________________________________________
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