PDA

View Full Version : Right Click menu


gbalajikumar
10-14-2004, 08:26 PM
Is there any way to create a right click menu in laslzo? My requirement is as follows

Suppose i will display 10 records of my customer with name and account number


Supose user right clicks on 3rd record, i need to show the menu with items account info, account holding and portfolio. So when user chooses account info, i need to show the screen with account information for that user. Is that possible in Laslzo? please help me in this?

metasarah
10-15-2004, 04:04 AM
Its not possible to add items to the right-click menu in Laszlo at the moment. We are working on this for a future release.

sahild
10-15-2004, 08:47 AM
I was also interested in use of right mouse click capabilities. In some initial testing we had users attempting to do this and they were confused by the menu they got.

dteare
10-16-2004, 09:10 AM
A right click menu is a very good idea. Is there a forum that users can cast votes for features in the next release?

metasarah
10-16-2004, 03:43 PM
We don't have a forum for voting on features, but if have the skills (or knows someone who does) and you want to build them yourselves, there more info on openlaszlo.org :D

Note: you can remove most of the right-click menus using an embed/object tag option.

metasarah
10-16-2004, 03:55 PM
I wonder if this no right click script (http://javascript.about.com/library/scripts/blnorightclick.htm) would capture the right-click event before it got to the Flash Player. It's just as likely to go the other way, but it might be worth a try if you folks are motivated to experiment.

ps
10-17-2004, 11:53 PM
Right click really works since Flash 7/MX 2004. Have a look at: http://www.webwasp.co.uk/tutorials/b16-right-click/context-menu-tute.php with any other version it's just a hack and could break any second.

metasarah
10-18-2004, 06:02 AM
I have seen that. Currently LPS compiles to SWF5, but we're working on SWF6 and SWF7 support.

I was just making a suggestion that folks could explore if they needed the feature right now. Many DHTML sites rely on such "hacks" independent of whether they use Flash -- I've seen that browser integration features are more reliable in the last few years. If you don't feel like diving into that, I totally understand. It can be challenging to suss out a reliable cross-browser implementation.

When SWF7 export is complete, we'll support the context menu for version of the player. It'll be interesting to see how many sites will want to require the latest Flash Player, but we plan to support it in any case.

ps
10-18-2004, 08:01 AM
Originally posted by metasarah
I have seen that. Currently LPS compiles to SWF5, but we're working on SWF6 and SWF7 support.

That's great news. More features and more performance with SWF7. :cool:


It'll be interesting to see how many sites will want to require the latest Flash Player, but we plan to support it in any case.

AFAIK, Windows XP SP2 contains Flash Player 6. Macromedia statistics here: Flash Player Version Penetration (http://www.macromedia.com/software/player_census/flashplayer/version_penetration.html)

cosmoboy
04-16-2005, 08:29 PM
The LPS 3.0 Release Candidate 1 has been released.
Has the context menu function been implemented?
I find the LzView.setContextMenu(ContextMenu)in the lzx reference document,but i can`t find the reference about the object "ContextMenu".
Any help?

Thanks

TripleToe
04-17-2005, 03:24 PM
I found some info on this by looking at the development release that is publicly available. See http://www.openlaszlo.org/wiki/Source_Access for downloading the lps-dev source code. In that code is a 'test' section that is not distributed with the normal RC1 build. There is a test class that attempts to use the context menu (aka right click menu). When I ran it, it seemed a little flaky, but it is there and the sample lzx file will give you some idea of how it will eventually work.

cosmoboy
04-18-2005, 05:33 PM
I find the context-menu.lzx .

it is working well in the swf7 and the syntax is very like the ActionScript.

Thanks!

as a matter of convenience,i list the source code as below:

<canvas debug="true" width="1800" height="800">
<method event="oninit">
Debug.showInternalProperties = true;
</method>

<debug x="200" fontsize="14" width="600" height="400"/>
<script>

function rightclick_handler (obj, menuobj) {
Debug.write("rightclick context menu", obj, menuobj);
}

function my_itemhandler(obj, item) {
Debug.write("menu item selected", obj, item);
}

var cm1 = new ContextMenu(rightclick_handler);
cm1.hideBuiltInItems();
cm1.addItem(new ContextMenuItem("LZX Canvas Custom Item!", my_itemhandler));
canvas.setContextMenu(cm1);

var cm2 = new ContextMenu(rightclick_handler);
cm2.hideBuiltInItems();
cm2.addItem(new ContextMenuItem("View Custom Item 1", my_itemhandler));
cm2.addItem(new ContextMenuItem("View Custom Item 2", my_itemhandler));
cm2.addItem(new ContextMenuItem("View Custom Item 3", my_itemhandler));


var cm3 = new ContextMenu(rightclick_handler);
cm3.hideBuiltInItems();
cm3.addItem(new ContextMenuItem("Text Custom Item 1", my_itemhandler));
cm3.addItem(new ContextMenuItem("Text Custom Item 2", my_itemhandler));

</script>
<simplelayout/>
<text id="foo" fontsize="26"
oninit="setContextMenu(cm3)">FOOBAR</text>
<view id="pp"
width="200" height="200" bgcolor="blue"
oninit="setContextMenu(cm2)"/>
</canvas>

jasonb
05-03-2005, 08:24 PM
I atempted to use your code but it did not function as expected, but I received no errors in the debug window. I'm also set up for swf7 in the lps.properties file. Do you have any clues as to why this may not be working for me?

Following is my code:

<canvas debug="true" width="100%" height="100%">

<method event="oninit">
Debug.showInternalProperties = true;
</method>

<debug x="350" fontsize="14" width="600" height="400"/>

<script>

function rightclick_handler (obj, menuobj) {
Debug.write("rightclick context menu", obj, menuobj);
}

function my_itemhandler(obj, item) {
Debug.write("menu item selected", obj, item);
}

var cm1 = new ContextMenu(rightclick_handler);
cm1.hideBuiltInItems();
cm1.addItem(new ContextMenuItem("LZX Canvas Custom Item!", my_itemhandler));
canvas.setContextMenu(cm1);

var cm2 = new ContextMenu(rightclick_handler);
cm2.hideBuiltInItems();
cm2.addItem(new ContextMenuItem("View Custom Item 1", my_itemhandler));
cm2.addItem(new ContextMenuItem("View Custom Item 2", my_itemhandler));
cm2.addItem(new ContextMenuItem("View Custom Item 3", my_itemhandler));


var cm3 = new ContextMenu(rightclick_handler);
cm3.hideBuiltInItems();
cm3.addItem(new ContextMenuItem("Text Custom Item 1", my_itemhandler));
cm3.addItem(new ContextMenuItem("Text Custom Item 2", my_itemhandler));

</script>
<text id="foo" fontsize="26"
oninit="setContextMenu(cm3)">FOOBAR</text>
<view id="pp"
width="200" height="200" bgcolor="blue"
oninit="setContextMenu(cm2)"/>




<simplelayout axis="y"/>
<view>
<simplelayout axis="x"/>
<button><b>B</b></button>
<button><b><i>I</i></b></button>
<button><b><u>U</u></b></button>
</view>
<inputtext id="test" width="300" height="200" >
This is some text to play with.
</inputtext>


</canvas>

jasonb
05-03-2005, 08:29 PM
When I added a ?lzt=swf to the end of my file call in the address bar, the context menu's started appearing. Thanks for the good code.

TripleToe
05-04-2005, 08:32 AM
Is it just me or does the context menu not work right? Using the code sample above, (along with a default compiler setting of SWF7) I can only get the context menu to start working when I right-click within the Debug window. Clicking on any view right after the lzx file loads in the browser shows the standard flash context menu. Once I right click in the debugger window, the menu will appear. Anyone else seeing this behavior?

TripleToe
05-04-2005, 09:26 AM
Nevermind, I found my answer. It is caused by this:

Note that the default HTML wrapper that is generated by the LPS will disable
the context menu, due to the "menu: false" that it uses in the Flash object tag.

So I can either change this tag or temporarily fix it by putting the ?lzt=swf&lzr=swf7 at the end of my URL in the browser. (although the lzr=swf7 part isn't necessary because I have it set in my lps.properties file under WEB-INF/lps/config)

moplin
08-26-2005, 10:29 AM
Does any one have an online example to test this functionality. I am on a computer where I can not install Laszlo.

I will try this later at home.

Thanks.

togawa
08-27-2005, 03:19 AM
here's sample.
right click in the box.

http://laszlo.jp/wiki/index.php?TIPS#qb9e5511

scanzano
01-08-2006, 07:00 AM
I have the same behavior as TripleToe

bigBADguy
10-31-2006, 09:37 PM
http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&postid=24983