I had asked you to post SmartGWT related questions on the SmatGWT forums and yet you post your question here??
On Fri, Sep 25, 2009 at 8:13 AM, Niks <[email protected]> wrote: > > still it is not coming i have written this code for disabling default > effect but then it is showing menu once only on right click and then > on again clicking it is not coming .... > > > ----------------------------------------------------------------------------------------- > > MarketWatchGrid.java-------------------------------------------------------------------------------------------------------------------------------------------------------- > > package com.example.mytest.client; > > import com.google.gwt.dom.client.Element; > import com.smartgwt.client.types.Visibility; > import com.smartgwt.client.widgets.Canvas; > import com.smartgwt.client.widgets.IButton; > import com.smartgwt.client.widgets.events.RightMouseDownEvent; > import com.smartgwt.client.widgets.events.RightMouseDownHandler; > import com.smartgwt.client.widgets.form.DynamicForm; > import com.smartgwt.client.widgets.form.fields.FormItem; > import com.smartgwt.client.widgets.form.fields.TextItem; > import com.smartgwt.client.widgets.form.fields.ToolbarItem; > import com.smartgwt.client.widgets.grid.ListGrid; > import com.smartgwt.client.widgets.grid.ListGridField; > import com.smartgwt.client.widgets.layout.VLayout; > import com.smartgwt.client.widgets.menu.Menu; > import com.smartgwt.client.widgets.menu.MenuItem; > import com.smartgwt.client.widgets.menu.events.ClickHandler; > import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent; > > public class MarketWatchGrid extends Canvas implements > RightMouseDownHandler { > private Menu menu; > private DynamicForm dynamicForm = new DynamicForm(); > > private ListGrid marketWatchGrid = new ListGrid(); > > public MarketWatchGrid() { > final VLayout vLayout = new VLayout(); > > vLayout.setWidth100(); > vLayout.setHeight100(); > ToolbarItem toolbarItem = new ToolbarItem(); > menu = new Menu(); > menu.setShowShadow(true); > menu.setShadowDepth(10); > > dynamicForm.setWidth(150); > dynamicForm.setHeight(150); > dynamicForm.setStyleName("vpLayout"); > dynamicForm.setTitle("Add Security"); > dynamicForm.hide(); > final TextItem exchangeItem = new TextItem(); > exchangeItem.setTitle("Exchange"); > exchangeItem.setRequired(true); > > final TextItem settlementItem = new TextItem(); > settlementItem.setTitle("Settlement Type"); > settlementItem.setRequired(true); > > final TextItem securityNameItem = new TextItem(); > securityNameItem.setTitle("Security Type"); > securityNameItem.setRequired(true); > > IButton clearButton = new IButton(); > clearButton.setTitle("Clear"); > IButton submitButton = new IButton(); > submitButton.setTitle("Submit"); > > IButton cancelButton = new IButton(); > cancelButton.setTitle("Cancel"); > toolbarItem.setButtons(clearButton, submitButton, > cancelButton); > dynamicForm.setFields(new FormItem[] { exchangeItem, > settlementItem, > securityNameItem, toolbarItem }); > marketWatchGrid.setWidth100(); > marketWatchGrid.setHeight100(); > marketWatchGrid.setAlternateRecordStyles(true); > marketWatchGrid.setShowAllRecords(true); > > ListGridField exchangeNameField = new > ListGridField("exchangeName", > "ExchangeName"); > ListGridField securityNameField = new > ListGridField("securityName", > "Security Name"); > > ListGridField securityCodeField = new > ListGridField("securityCode", > "Security Code"); > > ListGridField changeField = new ListGridField("change", > "Change"); > ListGridField bidQtyField = new ListGridField("bidQty", "Bid > Qty"); > ListGridField bidPriceField = new ListGridField("bidPrice", > "Bid > Price"); > ListGridField askPriceField = new ListGridField("askPrice", > "Ask > Price"); > ListGridField askQtyField = new ListGridField("askQty", > "AskQty"); > ListGridField lastTradedPriceField = new ListGridField( > "lastTradedPrice", "Last Traded Price"); > ListGridField netChangeField = new > ListGridField("netChange", > "Net Change"); > ListGridField preClosingPriceField = new ListGridField( > "preClosingPrice", "Pre Closing Price"); > ListGridField totalTurnOverField = new ListGridField > ("totalTurnOver", > "Total TurnOver"); > ListGridField openingPriceField = new > ListGridField("openingPrice", > "Opening Price"); > ListGridField dayLowField = new ListGridField("dayLow", "Day > Low"); > ListGridField dayHighField = new ListGridField("dayHigh", > "Day > High"); > > > marketWatchGrid.setFields(exchangeNameField, > securityNameField, > securityCodeField, changeField, bidQtyField, > bidPriceField, > askPriceField, askQtyField, > lastTradedPriceField, > netChangeField, preClosingPriceField, > totalTurnOverField, > openingPriceField, dayLowField, > dayHighField); > marketWatchGrid.setCanResizeFields(true); > > marketWatchGrid.setData(MarketWatchData.getRecords()); > > marketWatchGrid.addRightMouseDownHandler(this); > vLayout.addMember(marketWatchGrid); > vLayout.draw(); > > } > > @Override > public void onRightMouseDown(RightMouseDownEvent event) { > > final int x = event.getX(); > final int y = event.getY(); > > MenuItem addSecurityItem = new MenuItem("Add Security"); > addSecurityItem.addClickHandler(new ClickHandler() { > > @Override > public void onClick(MenuItemClickEvent event) { > menu.hide(); > dynamicForm.setTop(y); > dynamicForm.setLeft(x); > dynamicForm.show(); > > } > }); > MenuItem deleteSecurityItem = new MenuItem("Delete > Security"); > MenuItem buyItem = new MenuItem("Buy"); > MenuItem sellItem = new MenuItem("Sell"); > MenuItem marketWatchItem = new MenuItem("Market Watch "); > MenuItem saveMarketWatchItem = new MenuItem("Save Market > Watch"); > > menu.setItems(addSecurityItem, deleteSecurityItem, buyItem, > sellItem, > marketWatchItem, saveMarketWatchItem); > menu.setVisibility(Visibility.HIDDEN); > > menu.setLeft(x); > menu.setTop(y); > //disableContextMenu(marketWatchGrid.getElement()); > menu.showContextMenu(); > // enableContextMenu(marketWatchGrid.getElement()); > > } > > public static native void disableContextMenu(Element e) /*-{ > e.oncontextmenu = function() { return false; }; > }-*/; > > public static native void enableContextMenu(Element e) /*-{ > e.oncontextmenu = function() { return true; }; > }-*/; > > } > > > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ > > > > On Sep 23, 3:39 pm, Sanjiv Jivan <[email protected]> wrote: > > Please use the SmartGWT forums for SmartGWT specific questions : > http://forums.smartclient.com/forumdisplay.php?f=14 > > Try event.cancel() to prevent the default behavior of the browser context > > menu showing upon right-click. > > > > Sanjiv > > > > > > > > On Wed, Sep 23, 2009 at 2:12 AM, Niks <[email protected]> wrote: > > > > > Hi, > > > > > Can anywone please tell how to avoid default menu in mozilla . I have > > > created one application and implemented right click mouse event in > > > smartgwt but when clicking right mouse button mozilla is not showing > > > the pop up which i created it is showing its default how to resolve > > > the issue in smartgwt... > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
