|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
Contextual MenusHow do I implement a right-click on a field?
For example: Select word(s) in the field Right-click on field to get a context menu of choices: Cut Copy Paste etc. Bill Vlahosu _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusBonjour Bill,
Le 7 juin 08 à 09:58, Bill Vlahos a écrit : > How do I implement a right-click on a field? > > For example: > Select word(s) in the field > Right-click on field to get a context menu of choices: > Cut > Copy > Paste > etc. > > Bill Vlahos on mouseDown pButton if pButton = 3 then <build the menu on the fly> <put it into a 'popup menu' button> popup btn <'popup menu' button> end if end mouseDown And, of course, a menuPick handler in the script of <'popup menu' button>. As, usually, contextual menus may be called from different objects with different contents (they are contextual, right?), it's easier to gather all code to show the menu or respond to the user choice in a single place using a switch structure relaying on the target, a custom prop you have set, etc. As to build the menu contents on the fly, you might be interested in my tutorial #008 How to build and manage dynamic menus. From Tutorials PIcker or my website. Best regards from Paris, Eric Chatonet. ---------------------------------------------------------------- Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/ Email: eric.chatonet@.../ ---------------------------------------------------------------- _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusThanks Eric.
I've added the following script to a field: on mouseDown pButton if pButton = 3 then put "Cut" & return & "Copy" & return & "Paste" into tMenu put tMenu into button "b1" popup btn "b1" end if end mouseDown This didn't do anything until I also added a button (which can be hidden) called "b1". The button has a menuPick handler which correctly responds to the menu item selected. However the text that had been selected in the field is deselected when the popup menu pops up so the menuPick item doesn't have anything to work with. An example would be to copy the text so I need the originally selected text to work with. What am I missing? Bill Vlahos On Jun 7, 2008, at 1:47 AM, Eric Chatonet wrote: > Bonjour Bill, > > Le 7 juin 08 à 09:58, Bill Vlahos a écrit : > >> How do I implement a right-click on a field? >> >> For example: >> Select word(s) in the field >> Right-click on field to get a context menu of choices: >> Cut >> Copy >> Paste >> etc. >> >> Bill Vlahos > > on mouseDown pButton > if pButton = 3 then > <build the menu on the fly> > <put it into a 'popup menu' button> > popup btn <'popup menu' button> > end if > end mouseDown > > And, of course, a menuPick handler in the script of <'popup menu' > button>. > As, usually, contextual menus may be called from different objects > with different contents (they are contextual, right?), it's easier > to gather all code to show the menu or respond to the user choice in > a single place using a switch structure relaying on the target, a > custom prop you have set, etc. > > As to build the menu contents on the fly, you might be interested in > my tutorial #008 How to build and manage dynamic menus. > From Tutorials PIcker or my website. > > Best regards from Paris, > Eric Chatonet. > ---------------------------------------------------------------- > Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/ > Email: eric.chatonet@.../ > ---------------------------------------------------------------- > > > _______________________________________________ > use-revolution mailing list > use-revolution@... > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusBonjour Bill,
To not loose the focus in the field, just set the traversalOn of the button to false :-) Le 21 juil. 08 à 03:06, Bill Vlahos a écrit : > Thanks Eric. > > I've added the following script to a field: > on mouseDown pButton > if pButton = 3 then > put "Cut" & return & "Copy" & return & "Paste" into tMenu > put tMenu into button "b1" > popup btn "b1" > end if > end mouseDown > > This didn't do anything until I also added a button (which can be > hidden) called "b1". The button has a menuPick handler which > correctly responds to the menu item selected. > > However the text that had been selected in the field is deselected > when the popup menu pops up so the menuPick item doesn't have > anything to work with. An example would be to copy the text so I > need the originally selected text to work with. > > What am I missing? > > Bill Vlahos Best regards from Paris, Eric Chatonet. ---------------------------------------------------------------- Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/ Email: eric.chatonet@.../ ---------------------------------------------------------------- _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusEric,
That did it. Note there is no UI in the Properties of a button to set traversalOn. I had to do it from the message box. Not obvious for a beginner. One last question... How do I refer to the calling object (in this case the field) to send the action to? Lets say I have multiple fields that I want to use this for so I want to cut the selected text in the field I right clicked in. The menuPick handler is in the button. Thank you, Bill On Jul 21, 2008, at 2:37 AM, Eric Chatonet wrote: > Bonjour Bill, > > To not loose the focus in the field, just set the traversalOn of the > button to false :-) > > Le 21 juil. 08 à 03:06, Bill Vlahos a écrit : > >> Thanks Eric. >> >> I've added the following script to a field: >> on mouseDown pButton >> if pButton = 3 then >> put "Cut" & return & "Copy" & return & "Paste" into tMenu >> put tMenu into button "b1" >> popup btn "b1" >> end if >> end mouseDown >> >> This didn't do anything until I also added a button (which can be >> hidden) called "b1". The button has a menuPick handler which >> correctly responds to the menu item selected. >> >> However the text that had been selected in the field is deselected >> when the popup menu pops up so the menuPick item doesn't have >> anything to work with. An example would be to copy the text so I >> need the originally selected text to work with. >> >> What am I missing? >> >> Bill Vlahos > > Best regards from Paris, > Eric Chatonet. > ---------------------------------------------------------------- > Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/ > Email: eric.chatonet@.../ > ---------------------------------------------------------------- > > > _______________________________________________ > use-revolution mailing list > use-revolution@... > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual Menus> Note there is no UI in the Properties of a button to set traversalOn. I had
> to do it from the message box. Not obvious for a beginner. There is but it is called "Focus with keyboard" - which again is not obvious for anyone, beginner or not. > One last question... How do I refer to the calling object (in this case the > field) to send the action to? Lets say I have multiple fields that I want to > use this for so I want to cut the selected text in the field I right clicked > in. The menuPick handler is in the button. "the target" will get you that data. Cheers, Sarah _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusBill Vlahos wrote:
> > Note there is no UI in the Properties of a button to set traversalOn. I > had to do it from the message box. Not obvious for a beginner. I recommend setting your Rev preferences to show labels as the "name of transcript property" (in the General prefs pane) rather than showing just the general description (which is the default.) That's the first thing I always do. It really helps if the inspector labels match the scripting keywords (and it helps newcomers learn the language faster too.) If you do that, you'll see "traversalOn". > > One last question... How do I refer to the calling object (in this case > the field) to send the action to? Lets say I have multiple fields that I > want to use this for so I want to cut the selected text in the field I > right clicked in. The menuPick handler is in the button. Assuming there is some text selected in the field, you'd want either "the selection" (which is the text itself) or the "selectedChunk", which is a description of where the text is. If you get the selectedChunk, the last part of the description is the field, and you can parse that out. If you just want to operate on the text, you can do things like "copy the selection". -- Jacqueline Landman Gay | jacque@... HyperActive Software | http://www.hyperactivesw.com _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusJ. Landman Gay wrote:
> If you just want to operate on the text, you can do things like "copy > the selection". > Actually (she said, replying to herself) it's even easier than that. Rev already knows what's selected, so if you are just using the basic editing commands, all you need in a menupick is this: on menupick pwhich switch pwhich case "copy" copy break case "paste" paste break case "delete" delete break default end switch end menupick -- Jacqueline Landman Gay | jacque@... HyperActive Software | http://www.hyperactivesw.com _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusThere is a "Focus with keyboard" check box in the properties of a
regular button but not a popup button. I should have been more specific. Bill On Jul 21, 2008, at 6:36 PM, J. Landman Gay wrote: > Bill Vlahos wrote: >> Note there is no UI in the Properties of a button to set >> traversalOn. I had to do it from the message box. Not obvious for a >> beginner. > > I recommend setting your Rev preferences to show labels as the "name > of transcript property" (in the General prefs pane) rather than > showing just the general description (which is the default.) That's > the first thing I always do. It really helps if the inspector labels > match the scripting keywords (and it helps newcomers learn the > language faster too.) If you do that, you'll see "traversalOn". > >> One last question... How do I refer to the calling object (in this >> case the field) to send the action to? Lets say I have multiple >> fields that I want to use this for so I want to cut the selected >> text in the field I right clicked in. The menuPick handler is in >> the button. > > Assuming there is some text selected in the field, you'd want either > "the selection" (which is the text itself) or the "selectedChunk", > which is a description of where the text is. If you get the > selectedChunk, the last part of the description is the field, and > you can parse that out. If you just want to operate on the text, you > can do things like "copy the selection". > > -- > Jacqueline Landman Gay | jacque@... > HyperActive Software | http://www.hyperactivesw.com > _______________________________________________ > use-revolution mailing list > use-revolution@... > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusBill Vlahos wrote:
> There is a "Focus with keyboard" check box in the properties of a > regular button but not a popup button. I should have been more specific. I see. Yes, you're right, and this is one of my pet peeves with Revolution. The arbitrary division of buttons and fields into various "types" gives new users the impression that each button or field type is a discrete object. That isn't true. There is only one button and one field object, and the type of button or field it becomes is due entirely to the property settings you choose to apply. I'm sure RR thought that eliminating some properties from the inspector for different button "types" would reduce confusion, but I think in some ways it increases it. Instead of removing property settings from the inspector, I think dimming the inappropriate ones would be a much better solution. This would show newcomers that any button can become any other type, while still preventing users from choosing non-applicable settings for any given button style. -- Jacqueline Landman Gay | jacque@... HyperActive Software | http://www.hyperactivesw.com _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusOK. So with the help of a few great people on this list I now can do
popup contextual menus for fields. Thank you. A user suggested that pretty much every field (regular text field) should be able to have a contextual menu for Cut, Copy, and Paste at a minimum. How would I add this feature to all my editable fields? I can do them one at a time but that would be pretty tedious. There must be a more global way to do it. Bill On Jul 21, 2008, at 6:45 PM, J. Landman Gay wrote: > J. Landman Gay wrote: > >> If you just want to operate on the text, you can do things like >> "copy the selection". > > Actually (she said, replying to herself) it's even easier than that. > Rev already knows what's selected, so if you are just using the > basic editing commands, all you need in a menupick is this: > > on menupick pwhich > switch pwhich > case "copy" > copy > break > case "paste" > paste > break > case "delete" > delete > break > default > end switch > end menupick > > -- > Jacqueline Landman Gay | jacque@... > HyperActive Software | http://www.hyperactivesw.com > _______________________________________________ > use-revolution mailing list > use-revolution@... > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusOn 24/7/08 3:40 PM, "Bill Vlahos" <bvlahos@...> wrote:
> OK. So with the help of a few great people on this list I now can do > popup contextual menus for fields. Thank you. > > A user suggested that pretty much every field (regular text field) > should be able to have a contextual menu for Cut, Copy, and Paste at a > minimum. > > How would I add this feature to all my editable fields? I can do them > one at a time but that would be pretty tedious. There must be a more > global way to do it. In your card or stack script ON mouseDown pMouseBtnNum IF pMouseBtnNum = 3 THEN IF word 1 of the target = "field" THEN IF not(the locktext of the target) THEN popup btn "contextualMenu" END IF END IF END IF pass mouseDown END mouseDown Terry... > > Bill > > On Jul 21, 2008, at 6:45 PM, J. Landman Gay wrote: > >> J. Landman Gay wrote: >> >>> If you just want to operate on the text, you can do things like >>> "copy the selection". >> >> Actually (she said, replying to herself) it's even easier than that. >> Rev already knows what's selected, so if you are just using the >> basic editing commands, all you need in a menupick is this: >> >> on menupick pwhich >> switch pwhich >> case "copy" >> copy >> break >> case "paste" >> paste >> break >> case "delete" >> delete >> break >> default >> end switch >> end menupick >> >> -- >> Jacqueline Landman Gay | jacque@... >> HyperActive Software | http://www.hyperactivesw.com >> _______________________________________________ >> use-revolution mailing list >> use-revolution@... >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-revolution > > _______________________________________________ > use-revolution mailing list > use-revolution@... > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution -- Dr Terry Judd Lecturer in Educational Technology (Design) Biomedical Multimedia Unit Faculty of Medicine, Dentistry & Health Sciences The University of Melbourne Parkville VIC 3052 AUSTRALIA 61-3 8344 0187 _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: Contextual MenusBill
I've done this using the target function and a mouseDown handler in a card or stack script. Marty Knapp > OK. So with the help of a few great people on this list I now can do > popup contextual menus for fields. Thank you. > > A user suggested that pretty much every field (regular text field) > should be able to have a contextual menu for Cut, Copy, and Paste at a > minimum. > > How would I add this feature to all my editable fields? I can do them > one at a time but that would be pretty tedious. There must be a more > global way to do it. > > Bill > > On Jul 21, 2008, at 6:45 PM, J. Landman Gay wrote: > >> J. Landman Gay wrote: >> >>> If you just want to operate on the text, you can do things like >>> "copy the selection". >> >> Actually (she said, replying to herself) it's even easier than that. >> Rev already knows what's selected, so if you are just using the basic >> editing commands, all you need in a menupick is this: >> >> on menupick pwhich >> switch pwhich >> case "copy" >> copy >> break >> case "paste" >> paste >> break >> case "delete" >> delete >> break >> default >> end switch >> end menupick >> >> -- >> Jacqueline Landman Gay | jacque@... >> HyperActive Software | http://www.hyperactivesw.com use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
So many ways in XTalks (was: Re: Contextual Menus)Bonjour à tous,
Le 24 juil. 08 à 07:49, Terry Judd a écrit : > In your card or stack script > > ON mouseDown pMouseBtnNum > IF pMouseBtnNum = 3 THEN > IF word 1 of the target = "field" THEN > IF not(the locktext of the target) THEN > popup btn "contextualMenu" > END IF > END IF > END IF > pass mouseDown > END mouseDown I could not resist ;-) Rev allows many ways to script: Here is the same as the above using a function. What is interesting is that a function returns a value immediately when a condition matches and avoids using nested conditional structures or long statements with and/or. on mouseDown pButton if PopupAllowed(pButton) then popup btn "contextualMenu" -- end mouseDown ------------------------------ function PopupAllowed pButton if pButton <> 3 then return false if word 1 of the target <> "field" then return false if the lockText of the target then return false return true end PopupAllowed Best regards from Paris, Eric Chatonet. ---------------------------------------------------------------- Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/ Email: eric.chatonet@.../ ---------------------------------------------------------------- _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: So many ways in XTalks (was: Re: Contextual Menus)> Rev allows many ways to script: Agreed! > Here is the same as the above using a function. > What is interesting is that a function returns a value immediately > when a condition matches and avoids using nested conditional > structures or long statements with and/or. > > on mouseDown pButton > if PopupAllowed(pButton) then popup btn "contextualMenu" -- > end mouseDown > ------------------------------ > function PopupAllowed pButton > if pButton <> 3 then return false > if word 1 of the target <> "field" then return false > if the lockText of the target then return false > return true > end PopupAllowed I would also put this in a frontScript instead of a card/stack script in the event you need to use the mouseDown in a field for other reasons. The only real difference is to add the "pass mouseDown": on mouseDown pButton if PopupAllowed(pButton) then popup btn "contextualMenu" else pass mouseDown end mouseDown This way, if the user right-clicks/Control-clicks, the popup menu displays, otherwise the target field gets the mouseDown message that it can do with as it likes. Ken Ray Sons of Thunder Software, Inc. Email: kray@... Web Site: http://www.sonsothunder.com/ _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: So many ways in XTalks (was: Re: Contextual Menus)I like that especially when I can understand it. Very often I copy someone's
excellent code and just use it like a monkey... _______________________________________________ use-revolution mailing list use-revolution@... Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution |
|
|
Re: So many ways in XTalks |