Table right click

Hello,
I am trying to setup a "right click menu" on a table with menu items related to the cell (or at least to the row) where the right click was hit.
For example two such menu items will be "Add new row after" and "Add new row before".
For this reason, I need to get the cell (or at least the row) x and y position numbers where the click was asserted. I have tried to modify the example which can be found here: http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3E8FF56A4E034080020E74861&p_...
with no success. It works fine with the left click, but not with the right.
Please notice also that I have managed how to hide the built in right menu items associated with a table control and how to insert mine with the respective functions. What I am missing is just how to retrieve the cell coordinates in the table after a right click on it.
Many thanks for your suggestions,
Marco
Solved!
Go to Solution.

If you install your own menu callback(s), you can detect the active cell by using GetActiveTableCell inside the callback, this way:
void CVICALLBACK MenuCallback (int panelHandle, int controlID, int MenuItemID, void *callbackData)
    char    msg[512];
    Point    cell;
    GetActiveTableCell (panelHandle, controlID, &cell);
    if (!cell.y || !cell.x)
        MessagePopup ("Context menu", "No actual cell selected");
    else {
        sprintf (msg, "Active cell is:\nrow %d\ncolumn %d", cell.y, cell.x);
        MessagePopup ("Context menu", msg);
A table always has an active cell, which is independent from where the user clicks on the control, so in this case the "no cell selected" is not likely to happen. If you want to activate an actual cell depending on the mouse position you must hide the control menu and use the following lines in the table callback (not in the menu callback):
    switch (event) {
        case EVENT_LEFT_CLICK:
        case EVENT_RIGHT_CLICK:
            GetTableCellFromPoint (panel, control, MakePoint (eventData2, eventData1), &cell);
            if (cell.x == 0 && cell.y == 0) return 1;    // Mouse not on the cells area
            GetNumTableRows (panel, control, &r);
            SetTableCellRangeAttribute (panel, control, VAL_TABLE_ENTIRE_RANGE,
                ATTR_TEXT_BOLD, 0);     // Disable highlighting on the whole table
           SetTableCellRangeAttribute (panel, control, VAL_TABLE_ROW_RANGE (cell.y),
                ATTR_TEXT_BOLD, 1);     // Highlight entire row
            if (event == EVENT_LEFT_CLICK) break;
            // Context menu
           choice = RunPopupMenu (panel, control, panel, eventData1, eventData2, 0, 0, 0, 0);
            switch (choice) {
                case 0:                // No choice
                   break;
                // Here menu items must be added to handle operator selection
            break;
        // Other event cases here if needed
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?

Similar Messages

  • Copying a table with the right-click menu in schema browser fails to copy comments when string has single quote(s) (ascii chr(39))

    Hi,
    I'm running 32-bit version of SQL Developer v. 3.2.20.09 build 09.87, and I used the built in context menu (right-clicking from the schema browser) today to copy a table.  However, none of the comments copied.  When I dug into the PL/SQL that the menu-item is using, I realized that it fails because it doesn't handle single quotes within the comment string.
    For example, I have a table named WE_ENROLL_SNAPSHOT that I wanted to copy as WE_ENROLL_SNAPSHOT_V1 (within same schema name)
    1. I right-clicked on the object in the schema browser and selected Table > Copy...
    2. In the pop-up Copy window, I entered the new table name "WE_ENROLL_SNAPSHOT_V1" and ticked the box for "Include Data" option.  -- The PL/SQL that the menu-command is using is in the "SQL" tab of this window.  This is what I extracted later for testing the issue after the comments did not copy.
    Result: Table and data copied as-expected, but no column or table comments existed.
    I examined the PL/SQL block that the pop-up window issued, and saw this:
    declare
      l_sql varchar2(32767);
      c_tab_comment varchar2(32767);
      procedure run(p_sql varchar2) as
      begin
         execute immediate p_sql;
      end;
    begin
    run('create table "BI_ETL".WE_ENROLL_SNAPSHOT_V1 as select * from "BI_ETL"."WE_ENROLL_SNAPSHOT" where '||11||' = 11');
    select comments into c_tab_comment from sys.all_TAB_comments where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT' and comments is not null;
    run('comment on table BI_ETL.WE_ENROLL_SNAPSHOT_V1 is '||''''||c_tab_comment||'''');
    for tc in (select column_name from sys.all_tab_cols where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT')
        loop
       for c in (select comments from sys.all_col_comments where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT' and column_name=tc.column_name)
       loop
       run ('comment on column BI_ETL.WE_ENROLL_SNAPSHOT_V1.'||tc.column_name||' is '||''''||c.comments||'''');
    end loop;
    end loop;
    EXCEPTION
      WHEN OTHERS THEN NULL;
    end;
    The string of the table comment on WE_ENROLL_SNAPSHOT is this:
    WBIG table of frozen, point-in-time snapshots of Enrolled Students by Category/term/pidm. "Category" is historically, and commonly, our CENSUS snapshot; but, can also describe other frequencies, or categorizations, such as: End-of-Term (EOT), etc. Note: Prior to this table existing, Census-snapshots were stored in SATURN.SNAPREG_ALL. All FALL and SPRING term records prior-to-and-including Spring 2013 ('201230') have been migrated into this table -- EXCEPT a few select prior to Fall 2004 (200410) records where there are duplicates on term/pidm. NO Summer snapshots existed in SNAPREG_ALL, but were queried and stored retroactively (including terms prior to Spring 2013) for the purpose of future on-going year-over-year analysis and comparison.
    Note the single quotes in the comment: ... ('201230')
    So, in the above PL/SQL line 11 grabs this string into "c_tab_comment", but then line 12 fails because of the single quotes.  It doesn't know how to end the string because the single quotes in the string are not "escaped", and this messes up the concatenation on line 12.  (So, then no other column comments are created either because the block throws an error, and goes to line 22 for the exception and exits.)
    When I modify the above PL/SQL as my own anonymous block like this, it is successful:
    declare
      c_tab_comment VARCHAR2(32767);
    begin
    SELECT REPLACE(comments,chr(39),chr(39)||chr(39)) INTO c_tab_comment FROM sys.all_TAB_comments WHERE owner = 'BI_ETL'   AND table_name = 'WE_ENROLL_SNAPSHOT'  AND comments IS NOT NULL;
    EXECUTE IMMEDIATE 'comment on table BI_ETL.WE_ENROLL_SNAPSHOT_V1 is '''||c_tab_comment||'''';
    for tc in (select column_name from sys.all_tab_cols where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT')
        loop
       for c in (select REPLACE(comments,chr(39),chr(39)||chr(39)) comments from sys.all_col_comments where owner = 'BI_ETL' and table_name = 'WE_ENROLL_SNAPSHOT' and column_name=tc.column_name)
       loop
       EXECUTE IMMEDIATE 'comment on column BI_ETL.WE_ENROLL_SNAPSHOT_V1.'||tc.column_name||' is '||''''||c.comments||'''';
    end loop;
    end loop;
    EXCEPTION
      WHEN OTHERS THEN NULL;
    end;
    On lines 4 and 8 I wrapped the "comments" from sys.all_tab_comments and sys.all_col_comments with a replace command finding every chr(39) and replacing with chr(39)||chr(39). (On line 8 I also had to alias the wrapped column as "comments" so line 10 would succeed.)
    Is this an issue with SQL Developer? Is there any chance that the menu-items can handle single quotes in comment strings? ... And, of course this makes me wonder which other context menu commands in the tool might have a similar issue.
    Thoughts?
    thanks//jacob

    PaigeT wrote:
    I know about quick drop, but it isn't helpful here. I want to be able to right click on a string or array wire, navigate to the string or array palette, and select the corresponding "Empty?" comparator. In this case, since I do actually know where those functions live, and I'm already using my mouse to right click on the wire, typing ctrl-space to open quick drop and then typing in the function name is actually more work than navigating to it in the palette. It would just be nice to have it on hand in the location I naturally go to look for it the first time. 
    I don't agree with this work flow.  Right hand on mouse, left hand on home keys.  Pressing CTRL + Space is done with the left hands, and then you could assign "ea" to "Empty Array" both of which is accessible with the left hand.  Darren posted a bunch of great shortcuts for the right handed developer.
    https://decibel.ni.com/content/docs/DOC-20453
    This is much faster than waiting for any right click menu navigation, even if it is found in the suggested subpalette.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Regarding pop up menu on the right click of a row of a table in a frame

    hi to all,
    i am a naive in applet and swing.
    i have some proplem regarding table in a frame.
    actually i want to open a pop up menu on the right click of a row of a table in the frame.please send the code regarding this.

    Hi,
    You're probably better off directing this to the swing forum but a starter for ten is the use of the MouseListener interface and the boolean isRightMouseButton method.
    http://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html
    Regards,
    Chris

  • Mouse right click on the field of the ALV Table

    Hi Experts,
    I have a requirement where i want to show some pop up to user once he does right click on one of the field of ALV table.
    Can u plz tell me how i can do this.
    Thanks
    Mahesh

    Hi.,
    In WDA there are no such event I think.,
    check this thread : Right click event on dynamic alv
    hope this helps u.
    Thanks & Regards,
    Kiran

  • Right click table cell selection

    I'm making a GUI interface including a table. What I'd like to implement is ability to right click on the cell and open the options selection, similar as to when right click the icon on the desktop. Any ideas ?

    You will need to create the component that will show your options and then add a MouseListener to your table that detects the mouse event and shows your options.
    A good place to start would be to have a look at this link: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    And here: http://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html

  • Switch Off Right Click Options in Webdynpro table

    Hi all,
    Can we switch off the right-click options that show up when a user is displaying a webdynpro abap table?
    I dont want users to be able to hide columns.  There does not, however, seem to be a setting which controls this - it seems to be always on???
    Cheers,
    Brad

    Nice.
    This fixes the problem.  Again this was an SP11 thing (the system I am on is SP10 and didnt have this parameter), but OSS note 990724 provides this functionality.
    The trick with all users being affected was just me being stupid.  The application I have developed is a password reset tool for people who have forgotten their passwords (connected to CUA so you can fix passwords on all systems) so of course I didnt want them to have to log in (it uses Active Directory for user authentication, not SAP security).  So I connect them via an external alias with a fixed username and password - which means one technical user for all people accessing the application.  So if one person changes it, they change it for all...
    Switching off personalisation does the job, however, thanks a lot.  Next time I will look on my SP11 system for parameters before asking questions.
    Brad

  • Right click event on TABLE Cell

    Hi,
    I have a TABLE built on my webdynpro screen. Now the requirment is in the first column of the TABLE if the user right clicks on the cell a menu should come which has to be filled with custom menus.
    Please let me know how that can be acheived.
    Thanks
    Mahesh

    Hi,
    I think this can help? check this..
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3041fcd6-3833-2c10-efad-b545c6001553?quicklink=index&overridelayout=true
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/180c60c2e927d0e10000000a155369/content.htm
    Cheers,
    Kris.

  • Right Click event on tree table component

    Hi,
    I am using Jdev Studio Edition Version 11.1.1.4.0.
    I have one requirment to open popup on right click on tree table.
    give me some guide line how to do that in adf
    Thanks
    Kiran.

    drag and drop af:popup component into the contextMenu facet of the af:treeTable component

  • Right Click on inputText inside a table column - 11g

    Hi,
    I am using jdev 11.1.2.4.
    I need to open a menu using right click on an inputText inside a table column.
    I saw some examples, but there also the explorer menu opens instead of the defined contextMenu.
    We are using internet explorer 8.
    Does anyone knows how to do it?
    Thank you,
    Nina

    Hi,
    you forgot to mention what you've seen in regards to examples. So suppress the IE native context menu, try
    http://tompeez.wordpress.com/2011/09/12/surpress-contextmenu-on-adf-components/
    Note though that using af:showPopupBehavior for context should also suppress the native IE menu
    Frank

  • How can I modify the "right click" menu of a table control?

    Hello,
      How can I modify the "right click menu" of a table control. I would like to be able to remove the ability to add or delete columns and maybe other selections. I want to keep the ability to
    add or delete rows

    Hi Andy,
    Dialog & User Interface VIs -> Menu functions
    Never used them, eh?

  • Right Click Context Menue Pivot Table

    Hi i have a question about the context menue when you make a right click on a pivot table. Is it possible to change the default language english from the menue into for exmaple to German.
    thx for any ideas
    Thomas

    Hi,
    I have more or less the same question. Any ideas?
    thanks & regards,
    Eric

  • Right click on Table header

    Hi,
    Is there any way to capture the right click on the table header of JTable? Can anyone tell me the way to do this.
    Thanks and Regards,
    R.Vishnu Varadhan.

    Thanks for the help.
    Its working.
    Regards,
    R.Vishnu Varadhan.

  • Popupmenu with a right click  on a table

    hi,
    is it possible to popup a menu on the table if rightclicked...
    regards

    check this piece of code, i m not getting the popup
    public void mouseClicked(MouseEvent me){
         int m=me.getModifiers();
    if(m==InputEvent.BUTTON3_MASK)
                   System.out.println("right clicked");
                   if(me.isPopupTrigger())
    JPopupMenu jpm=new JPopupMenu();
                   JMenuItem bin=new JMenuItem("BIN");
         JMenuItem hex=new JMenuItem("HEX");
                   JMenuItem oct=new JMenuItem("OCT");
                   jpm.add(bin);jpm.addSeparator();
                   jpm.add(hex);jpm.addSeparator();
                   jpm.add(oct);jpm.addSeparator();
                   JButton j=new JButton();
                   jf1.getContentPane().add(j);     
                   t.add(jpm);
         t.addMouseListener(m);

  • Disabling thepivoting the table or formatting when right clicking..

    Hello Experts
    I have a report in the table format and currently the user can right click on the report and do sorting excluding the column etc.. also a little grey header on the column heading. Now the user wants to disbale all this, is there is a way that i will be able to do this?
    Thanks
    Ravi

    Hi,
    Just Edit your analysis and then click on "Analysis Properties dialog" then select Interactions tab here you uncheck all the Interactions link then save it and test it.
    Note: it will affect this report only. if you want to disable enitre report just add below content in your instanceconfig.xml file then restart bi presentation services then test it out.
    Include the elements and their ancestor elements as appropriate, as shown in the following example:
    <ServerInstance>
    <Analysis>
    <InteractionProperties>
    <InteractionPropertyAddRemoveValues>false</InteractionPropertyAddRemoveValues>
    <InteractionPropertyCalcItemOperations>false</InteractionPropertyCalcItemOperations>
    <InteractionPropertyDrill>false</InteractionPropertyDrill>
    <InteractionPropertyGroupOperations>false</InteractionPropertyGroupOperations>
    <InteractionPropertyInclExclColumns>false</InteractionPropertyInclExclColumns>
    <InteractionPropertyMoveColumns>false</InteractionPropertyMoveColumns>
    <InteractionPropertyRunningSum>false</InteractionPropertyRunningSum>
    <InteractionPropertyShowHideSubTotal>false</InteractionPropertyShowHideSubTotal>
    <InteractionPropertySortColumns>false</InteractionPropertySortColumns>
    </InteractionProperties>
    </Analysis>
    </ServerInstance>
    For More Refer Oracle Note:
    http://docs.oracle.com/cd/E23943_01/bi.1111/e10541/answersconfigset.htm#BIESG3772
    18.3.4 Manually Configuring for Interactions in Views
    Thanks
    Deva

  • How to disable right click option re-size on table column header?

    Hi All,
    Please let us know how to disable right click option re-size on table column header.
    The issue is that when I right click on the column header, the column is selected and the context menu with options like Sort, Columns, Resize Columns, etc.. is popping. we want to disable column  re-size option.
    We are binding the table values programatically (not using Bc4J) and the Jdeveloper version is 11.1.2.2
    Thanks in advance,
    - Vignesh S.

    Hi Gawish,
    Thanks for the reply.
    This will make the particular column frozen and only work for that particular column.
    My use case is that to remove the resize columns option from the context menu or to disable the right click option.
    Making column selection as none will disable the right click option but we need column selection for sorting.
    Is there any other way to achieve this?
    Thanks in advance,
    -Vignesh S.

Maybe you are looking for

  • MS Office 2010 Home & Student 2010 on Window 8.1

    Hi All, I recently purchased a new laptop that comes with Window 8.1 as well as a complimentary Office 2010 Home and Student. I have followed the instruction to download via www.office.com/productkeycard and saved on my desktop. However, upon complet

  • (again) oracle 10g client and oracle 10g express in one computer

    hi again, sorry if this question looks like a double post to you. Well this is quite embarassing yet still make some headache for me. I have my office PC installed with Oracle 10g client using admin component option, for connecting some application w

  • Installed the update. Can't get internet. Anyone else with similar problems

    Can't get the wireless to work after uploading the update.

  • Parameter in CASE WHEN in Select list

    Hi. Parameters in case when into a select list why doen't work? I've this query: SELECT "UNORG"."Unità Organizzativa Vendita" as "Unità Organizzativa Vendita", CASE WHEN "Tempo"."Mese" = :MESE THEN "Vendite-Ore Rgc"."Importo Venduto" END as "Importo

  • Creating DVD-ROM content?

    Premier Pro CS3, Windows XP, 2GB RAM, plenty fast hard drives I'd like to create a DVD with both video and DVD-ROM content. Is that possible? If not, then suggestions for the following ... part of the DVD is video content in the form of slide shows s