Re: popUp a button with itself on modified mouseDown?

2014-07-02 Thread Peter Brigham
I'm late to this discussion but here's what I do. It's a modular solution,
and I use it a lot. It's great for contextual menus for right-clicking in a
field (customize the button contents depending on context) and I've often
used it for just what you are doing, to offer a popup list on
right-clicking a standard button. Once it's set up you will likely find
yourself using it for lots of things, since calling it is as simple as:
   put popChoose(Vera,Chuck,Dave,-,Lovely Rita,Nowhere Man)
into uChoice

function popChoose
   -- create a popup button in your mainstack or a library stack
   --button style = menu, menumode = popup, name = contextualMenu
   --button script:
   --  on menupick what
   -- set the uSelection of me to what
   --  end menupick
   -- make the button invisible when you're done, if needed

   -- then 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 Vera  cr  Chuck  cr  Dave into choiceList
   -- put popChoose(choiceList) into userChoice
   -- or: put popChoose(choice1,choice2,choice3) into userChoice
   -- or: put popChoose(One,Two,Three) into userChoice

   constant popChooseStackName = yourLibraryStack

   put the params into tList
   put offset((,tList) into q
   delete char 1 to q of tList
   delete char -1 of tList
   replace comma  space  quote with comma  quote in tList
   replace quote  comma  quote with cr in tList
   if char 1 of tList = quote then delete char 1 of tList
   if char -1 of tList = quote then 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 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
   return u
end popChoose

-- Peter

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


On Mon, Jun 30, 2014 at 7:36 PM, Michael Doub miked...@gmail.com wrote:

 create a popup button
 move it to -100,-100

 create your standard visible button with the following script:

 on mousedown thebutton
   popup button x
else
   beep
end if
 end mousedown

 Does this do what you want?

 -= Mike



 On Jun 30, 2014, at 7:19 PM, Dr. Hawkins doch...@gmail.com wrote:

  On Mon, Jun 30, 2014 at 4:17 PM, Michael Doub miked...@gmail.com
 wrote:
 
  Take a look at the button style, menumode and general appearance
  properties.  I would think that you could dynamicly change the style and
  menu mode and general appearance.   Just a thought….
 
 
  Within limits, it does that so far.
 
  The code I have successfully changes the button type; my problem is
 getting
  the now-popup to pop.
 
  --
  Dr. Richard E. Hawkins, Esq.
  (702) 508-8462
  ___
  use-livecode mailing list
  use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: popUp a button with itself on modified mouseDown?

2014-07-02 Thread Michael Doub
Thanks Peter.  Very handy.

-= Mike

On Jul 2, 2014, at 8:16 AM, Peter Brigham pmb...@gmail.com wrote:

 I'm late to this discussion but here's what I do. It's a modular solution,
 and I use it a lot. It's great for contextual menus for right-clicking in a
 field (customize the button contents depending on context) and I've often
 used it for just what you are doing, to offer a popup list on
 right-clicking a standard button. Once it's set up you will likely find
 yourself using it for lots of things, since calling it is as simple as:
   put popChoose(Vera,Chuck,Dave,-,Lovely Rita,Nowhere Man)
 into uChoice
 
 function popChoose
   -- create a popup button in your mainstack or a library stack
   --button style = menu, menumode = popup, name = contextualMenu
   --button script:
   --  on menupick what
   -- set the uSelection of me to what
   --  end menupick
   -- make the button invisible when you're done, if needed
 
   -- then 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 Vera  cr  Chuck  cr  Dave into choiceList
   -- put popChoose(choiceList) into userChoice
   -- or: put popChoose(choice1,choice2,choice3) into userChoice
   -- or: put popChoose(One,Two,Three) into userChoice
 
   constant popChooseStackName = yourLibraryStack
 
   put the params into tList
   put offset((,tList) into q
   delete char 1 to q of tList
   delete char -1 of tList
   replace comma  space  quote with comma  quote in tList
   replace quote  comma  quote with cr in tList
   if char 1 of tList = quote then delete char 1 of tList
   if char -1 of tList = quote then 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 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
   return u
 end popChoose
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 
 On Mon, Jun 30, 2014 at 7:36 PM, Michael Doub miked...@gmail.com wrote:
 
 create a popup button
 move it to -100,-100
 
 create your standard visible button with the following script:
 
 on mousedown thebutton
  popup button x
   else
  beep
   end if
 end mousedown
 
 Does this do what you want?
 
 -= Mike
 
 
 
 On Jun 30, 2014, at 7:19 PM, Dr. Hawkins doch...@gmail.com wrote:
 
 On Mon, Jun 30, 2014 at 4:17 PM, Michael Doub miked...@gmail.com
 wrote:
 
 Take a look at the button style, menumode and general appearance
 properties.  I would think that you could dynamicly change the style and
 menu mode and general appearance.   Just a thought….
 
 
 Within limits, it does that so far.
 
 The code I have successfully changes the button type; my problem is
 getting
 the now-popup to pop.
 
 --
 Dr. Richard E. Hawkins, Esq.
 (702) 508-8462
 ___
 use-livecode mailing list
 use-livecode@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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


popUp a button with itself on modified mouseDown?

2014-06-30 Thread Dr. Hawkins
I'm trying to get a button to normally be a boring old popup, but allow
other things to be chosen by it.

The natural way would seem to to change it on mousenter if the specified
modifier key is down, or if the second button is clicked.

I get the change to happen trivially, but if I'm doing it from a mouseDown,
I can't get it to display itself.  I'm trying things like,

on mouseDown bt
   if bt=3 then
  popup  button the short name of the target
   end if
   pass mouseDown
end mouseDown

But I'm not finding a magic combnation
-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: popUp a button with itself on modified mouseDown?

2014-06-30 Thread Paul Hibbert
If your script is in a PopUp Menu button then it's probably just getting 
confused trying to pop up itself!

Maybe try something like this in a PopUp Menu ensuring that the 
menuMouseButton prop is set to 1…

local sModKey

on mouseDown
   --ShiftKey check
   if the shiftKey is down then
  put Shift Key and into sModKey
   else
  put Just into sModKey
   end if
end mouseDown

on mouseUp pBtn
   if pBtn = 3 then answer sModKey  the short name of me
end mouseUp

on menuPick pItemName
 answer sModKey  pItemName
end menuPick

HTH

Paul

On 2014-06-30, at 8:48 AM, Dr. Hawkins doch...@gmail.com wrote:

 I'm trying to get a button to normally be a boring old popup, but allow
 other things to be chosen by it.
 
 The natural way would seem to to change it on mousenter if the specified
 modifier key is down, or if the second button is clicked.
 
 I get the change to happen trivially, but if I'm doing it from a mouseDown,
 I can't get it to display itself.  I'm trying things like,
 
 on mouseDown bt
   if bt=3 then
  popup  button the short name of the target
   end if
   pass mouseDown
 end mouseDown
 
 But I'm not finding a magic combnation
 -- 
 Dr. Richard E. Hawkins, Esq.
 (702) 508-8462
 ___
 use-livecode mailing list
 use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: popUp a button with itself on modified mouseDown?

2014-06-30 Thread J. Landman Gay

On 6/30/2014, 10:48 AM, Dr. Hawkins wrote:

I'm trying to get a button to normally be a boring old popup, but allow
other things to be chosen by it.


I'm confused about what you want to do. But if my guess is right, you 
want to change the button's menu content on a mouseDown.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: popUp a button with itself on modified mouseDown?

2014-06-30 Thread Dr. Hawkins
On Mon, Jun 30, 2014 at 12:02 PM, J. Landman Gay jac...@hyperactivesw.com
wrote:

 I'm confused about what you want to do. But if my guess is right, you want
 to change the button's menu content on a mouseDown.


I want the button to normally be a plain old boring standard button.  I
want to make related functions available by right-click.  So if the user
just clicks the button, it does the normal script, but if it's a
right-click, I want the list of choices to pop up (and the various course
of code selected) to be chosen.

I suppose I could do this with a group with a push-button and a hidden
popup button, but the single button seems cleaner.  (Although the group
could mean I could have a behavior for the button, and still have a script
for the group . . .


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: popUp a button with itself on modified mouseDown?

2014-06-30 Thread Michael Doub
Take a look at the button style, menumode and general appearance properties.  I 
would think that you could dynamicly change the style and menu mode and general 
appearance.   Just a thought….

-= Mike


On Jun 30, 2014, at 6:25 PM, Dr. Hawkins doch...@gmail.com wrote:

 On Mon, Jun 30, 2014 at 12:02 PM, J. Landman Gay jac...@hyperactivesw.com
 wrote:
 
 I'm confused about what you want to do. But if my guess is right, you want
 to change the button's menu content on a mouseDown.
 
 
 I want the button to normally be a plain old boring standard button.  I
 want to make related functions available by right-click.  So if the user
 just clicks the button, it does the normal script, but if it's a
 right-click, I want the list of choices to pop up (and the various course
 of code selected) to be chosen.
 
 I suppose I could do this with a group with a push-button and a hidden
 popup button, but the single button seems cleaner.  (Although the group
 could mean I could have a behavior for the button, and still have a script
 for the group . . .
 
 
 -- 
 Dr. Richard E. Hawkins, Esq.
 (702) 508-8462
 ___
 use-livecode mailing list
 use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: popUp a button with itself on modified mouseDown?

2014-06-30 Thread Dr. Hawkins
On Mon, Jun 30, 2014 at 4:17 PM, Michael Doub miked...@gmail.com wrote:

 Take a look at the button style, menumode and general appearance
 properties.  I would think that you could dynamicly change the style and
 menu mode and general appearance.   Just a thought….


Within limits, it does that so far.

The code I have successfully changes the button type; my problem is getting
the now-popup to pop.

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: popUp a button with itself on modified mouseDown?

2014-06-30 Thread Mike Bonner
From your example above, you're having the button try to pop itself up.
Thats the only case where you probably don't want to manually popup
button..

The key is to check the conditions, have other popup buttons with your
context menus set up, and if the conditions are met, then popup button
whatever to make the alternate appear.  If no conditions are met, just
pass mousedown instead and the menu of the current button will popup.  The
main problem with this method (at least as tested on my windows machine) is
that if you popup a secondary button menu, the hilite of the main button
can go funky, so you'd have to handle the hilited of the button in your
code.

To test, I set up two buttons, as someone else posted I was just checking
for button 3 (rt click) and if it was right clicked, pop up the alternate
menu, else just pass mousedown and the main buttons menu shows up.

Another option would be to have a loop checking conditions.. (like checking
what keys are down) and modify the menu list of the main popup button on
the fly. This eats processor cycles of course, but works pretty well for
the most part.




On Mon, Jun 30, 2014 at 5:19 PM, Dr. Hawkins doch...@gmail.com wrote:

 On Mon, Jun 30, 2014 at 4:17 PM, Michael Doub miked...@gmail.com wrote:

  Take a look at the button style, menumode and general appearance
  properties.  I would think that you could dynamicly change the style and
  menu mode and general appearance.   Just a thought….


 Within limits, it does that so far.

 The code I have successfully changes the button type; my problem is getting
 the now-popup to pop.

 --
 Dr. Richard E. Hawkins, Esq.
 (702) 508-8462
 ___
 use-livecode mailing list
 use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: popUp a button with itself on modified mouseDown?

2014-06-30 Thread Michael Doub
create a popup button
move it to -100,-100

create your standard visible button with the following script:

on mousedown thebutton
  popup button x
   else 
  beep
   end if
end mousedown

Does this do what you want?

-= Mike



On Jun 30, 2014, at 7:19 PM, Dr. Hawkins doch...@gmail.com wrote:

 On Mon, Jun 30, 2014 at 4:17 PM, Michael Doub miked...@gmail.com wrote:
 
 Take a look at the button style, menumode and general appearance
 properties.  I would think that you could dynamicly change the style and
 menu mode and general appearance.   Just a thought….
 
 
 Within limits, it does that so far.
 
 The code I have successfully changes the button type; my problem is getting
 the now-popup to pop.
 
 -- 
 Dr. Richard E. Hawkins, Esq.
 (702) 508-8462
 ___
 use-livecode mailing list
 use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode