How to know if a particular CWPlot already exists in a CWGraph (VC++)?

I would like to add a CWPlot to a CWGraph only if this plot doesn't already
exist within the CWPlots collection.
The problem is that when I call "myGraph.GetPlots().item((COleVariant)
"PlotN")", an exception is throwned if the CWPlot named "PlotN" doesn't
exist.
I do have a workaround : testing all the names of CWPlots collection untill
I find (or not) the right name, but as I have a lot of plots in my graph, it
is very time expensive.
Is there a more elegant way of knowing a plot presence in a graph ?

Georges:
Exceptions are the way that C++ handles all errors, and it's okay to catch exceptions yourself and process them however you like. In this case, for example, I would recommend trying the Item() call and catching the resulting exception. Examine the exception, and if it is one complaining about an "Invalid Index", then you can add the plot and suppress the exception from propagating up the call stack. Here's an example of what I mean:
//================================================​==============================
// Return the requested plot. If it's not there, then add it and return it.
//================================================​==============================
CCWPlot CGeorgesDlg:martGetPlot(CCWGraph &graph, LPCTSTR name)
CCWPlot plot;
try {
plot = graph.GetPlots().Item(COleVariant(name));
catch(COleDispatchException *e) {
// If it's not the exception we're looking for, let it go up the call
// stack, otherwise ignore it.
if(e->m_scError != 0x800A0005) /* invalid index */
throw e;
e->Delete();
// If an exception occured, then add the plot.
if(plot.m_lpDispatch == NULL)
plot = graph.GetPlots().Add();
plot.SetName(name);
return plot;
You could use this helper method to access plots. For example:
void CGeorgeDlg:nModifyPlot()
SmartGetPlot(m_graph,"Plot X").SetEnabled
(TRUE);
// or
CCWPlot MyPlot = SmartGetPlot(m_graph,"Plot Y");
// work with MyPlot variable....
I hope this helps,
Chris W.
National Instruments

Similar Messages

  • How to know whether a particular query is using the aggregates

    hi all....
    im very new to this group so plz help me out.....anyway hi to all ....
    There are many aggreegates are there but how to know which query is using perticular a?gregates

    Hi,
    use query monitor screen RSRT and select the option execute + debug . and u can have the option of checking display aggreagates for that query!
    cheers,
    ravi

  • How to induct Quality criteria in to already existing Vendor Evaluation ?

    Hi
    My Client has configured all the Vendor Evaluation structure. But Quality is not maintained in that structure. Now,
    1. How can we induct Quality in to the Vendor Evaluation without disturbing the other main criteria in it ?
    2. Will there be sudden impact on the other areas in the system ?
    3. Should the Quality management be activated for the materials if they are to be considered in to this Vendor Evalution. ?
    Thanks
    Maruthi

    1. How can we induct Quality in to the Vendor Evaluation without disturbing the other main criteria in it ?
    you can just activate the quality criteria (it is already exist in the system)
    2. Will there be sudden impact on the other areas in the system ?
    No
    3. Should the Quality management be activated for the materials if they are to be considered in to this Vendor Evalution. ?
    Yes if you want the system to be calculated automatically otherwise make the quality criteria as manual and enter the points when you run vensor evaluation.
    if you keep automatic than it will read from usage decision and to have that the QM should be active.

  • How to find out if a structure already exists in DDIC

    Hi all,
    I want to find out if a structure or table type already exists in the DDIC. I intend to use the DDIF_TABL_GET function module and catch the exception raised but I am not sure if this 'illegal input'  exception is only raised if a structure does not exist in DDIC. Is it the right way or is there a function module or static class method which can return me this info stg. like DDIC_OBJECT_EXISTS or not . I have the same problem for the table types too, but I think the solution must be similar...
    Kind Regards,
    Sükrü Ilker Birakoglu

    Hi all,
    Thank you for your answers. I also found an alternative way for solving the problem. If you call the function module DDIF_TABL_GET with the state parameter set to 'M' (get the object regardless of its state(active, new)), the export parameter GOTSTATE shows us if the object in DDIC exists or not(if this parameter is space, then the object does not exist).
    Kind Regards,
    Sükrü Ilker Birakoglu

  • How to know when a topic does not exist

    I have an app that is created with Visual Studio 6, which
    does not have native support for HTML help (upgrading VS is
    currently not an option). I have an HTML help that I would like to
    call from my app. I need to call the html help with a context id
    number. Since there is no html help calls in this version of VS, I
    am calling hh.exe directly using ShellExecute ("hh.exe -mapid
    <id> <chm file>"). I dont know of any other way. The
    problem I am having is that there are times when my app and the
    help may be out of sync. It is possible that my app will call the
    help with an id that does not exist in the help. In WinHelp, the
    user would get a message indicating that the topic did not exist.
    Unfortunately, hh.exe does not return any messages. This makes the
    users think something is wrong with the app.
    Am I doing this the right way? Is there a way to find out if
    a topic exists and notify the user if it does not?
    Thanks in advance for you help.
    LA

    Hi LAYALA,
    We also develop with Visual Studio 6. You can override the
    WinHelp calls and redirect to HtmlHelp. Our app was originally
    developed using WinHelp. We made the change to HTMLHelp several
    years back and my developer claims it only took one line of code,
    though he's never told me what that line is. If nobody enters into
    this forum, I'll ask him tomorrow. I'm on Paciifc time so it will
    be quite a few hours from now.
    John

  • Can AS know if an desktop icon already exists in a location

    this code moves a file on the desktop to a specific location.
    tell application "Finder"
    set desktop position of alias "Macintosh HD:Users:Shawn:Desktop:The Matrix Effect - Video.webloc" to {1800, 1000}
    end tell
    Can you ask Applescript if an icon is already there, if so then just add 100 pixels in the code so the new icon is offset a bit. Thanks

    For most (but not all) properties, if you can set them then you can also get them (check the application dictionary to verify the properties you're after).
    Therefore, in this case, all you need to do is first get the desktop position, then you can make whatever adjustments you like:
    tell application "Finder"
      set thePos to desktop position of alias "Macintosh HD:Users:Shawn:Desktop:The Matrix Effect - Video.webloc"
      -- now you have the icon position so move it
      set desktop position of alias "Macintosh HD:Users:Shawn:Desktop:The Matrix Effect - Video.webloc" to {(item 1 of thePos) + 100, (item 2 of thePos) + 100}
    end tell
    If you want some kind of collision detection (to see if there's an icon in that place already) you'll need to get the desktop position of each item on the desktop and iterate through them. It'll be relatively easy to account for icon size (just add an offset to your checks), but handling the text label will be harder (there's no way I'm aware of to find the position of the file name).
    (you don't say which way you want to move it, just amend the offsets as appropriate)

  • How to add exclude criteria in the already existing group

     I have a created a group with this criteria ( Object is Windows Computer AND ( NetBIOS Computer Name Matches
    wildcard *-XXX*|*-SSS*|*YYY*|*ZZZ*|*PPP|*QQQ* ) AND True )
    Now i got the request to exclude NetBIOS Computer Name Like
     *ABCD* . in the above group.
    How do include the exclusion in this group?

    Hi,
    I think a RegEx will be the best for this situation.
    http://blogs.infosupport.com/dynamic-group-population-in-opsmgr-with-regular-expressions/
    Cheers
    Christoph Maresch | My blogs: blog.cmaresch.at | XING:
    Christoph Maresch
    | Linkedin:
    Christoph Maresch

  • How I know if a user define field exist?

    Hi,
    I need to add a user define field to the business partner table using the SDK. Before I add the field I would like to create a condition to know if the field exist.
    I will appreciate any help
    Thanks.

    Dear Rafael ...
    If you want to check whether there're any user fields you can use recordset to look for the name of field in CUFD table. Here with I enclose example to Look for Fields "ColorID" in "@MSI_COLOR" Table .
    ===============================================
    Private Function CheckUserFields() As Boolean
    oRecordset.DoQuery "select count(*) from CUFD where TableId='@MSI_COLOR' And AliasID='ColorID' "
    If oRecordset.Fields(0).Value > 0 Then
       CheckUserFields = True
    Else
       CheckUserFields = False
    End If
    End Function
    ======================================
    You can use that function ...
    If  CheckUserFields = True then
    Else
        oSboApplication.messagebox "Field Colot Is Not Found in SAP B1 "
    End If
    Hopefully can helps
    Regards,
    Hamdi

  • How to find out the path of already existing directory?

    I need to get the exact path of 'FCO_DIR' directory. Could you please help me out with this.
    Is there any table name or a quey that I can run to get this information?
    Below is the code that I am using :
    Code:
    l_input_dir CONSTANT VARCHAR2 (30) := 'FCO_DIR';
    l_input_file CONSTANT VARCHAR2 (30) := abc_ca_upd.dat';
    fhandle := UTL_FILE.fopen (l_input_dir, l_input_file, 'r');
    Thanks in Advanvce !!

    900811 wrote:
    I tried running this query in production. I am getting error message ORA-00942: table or view does not exist
    Does this require DBA privileges ?As mentioned before, this should not require "DBA privileges", whatever that means, but it requires rights to query the view (think least privileges principle).
    Did you try querying ALL_DIRECTORIES instead? (or USER_ equivlent)
    In dev environment, I am getting the correct results.What is the output from ALL_DIRECTORIES in dev?

  • How to find out, if a dynamic genereated structure already exists in DDIC?

    Good morning developers,
    can you help me with that above mentioned problem?
    I'm about to write a report which manages to change tablecontrol(s) to alvgrids.
    My current problem is, that i read all fields of a tablecontrol and generate its <b>structure</b> dynamically ( temporary just during runtime of the report, not stored yet ).
    Now I have to know, if this generated structure already exists in the DDIC, or not.
    If not, i have to create a type of my generated structure and store it in the DDiC.
    I know that there s a FM called <b>"COMPARE_STRUCTURE_DATA"</b>.
    But i think i have to know the name of the existing structure in DDiC.
    Is there also a way for a recursive search in ddic?
    If not:  when i read the fields of my tablecontrol from the DDiC, i read from ddic-table D021S. In its field "FNAM" it contains for example SFLIGHT-carrid ( <table><column> ).
    I could split 'FNAM' into table and column. How do i search for the structuretype of a table?
    Thx for your replys, post points waiting
    Regards
    Basti

    Hello Bastian
    All dynpro fields (including table controls) are either based on DDIC structures of program variables. Thus, the following coding will return you the required answer.
    *& Report  ZUS_SDN_RTTI_IS_DDICTYPE
    REPORT  zus_sdn_rtti_is_ddictype.
    TYPE-POOLS: abap.
    TYPES: BEGIN OF ty_s_line.
    TYPES:   field(3)  TYPE n.
    TYPES:   flag(1)   TYPE c.
    " INCLUDE TYPE knb1.
    TYPES: END OF ty_s_line.
    TYPES: ty_t_line    TYPE STANDARD TABLE OF ty_s_line
                        WITH DEFAULT KEY.
    DATA:
      gs_line    TYPE ty_s_line,
      gs_knb1    TYPE knb1,
      go_tabdescr      TYPE REF TO cl_abap_tabledescr,
      go_strucdescr    TYPE REF TO cl_abap_structdescr.
    START-OF-SELECTION.
      go_strucdescr ?= cl_abap_tabledescr=>describe_by_data( gs_line ).
      IF ( go_strucdescr->is_ddic_type( ) = abap_true ).
        WRITE: / 'gs_line is a DDIC type'.
      ELSE.
        WRITE: / 'gs_line is not a DDIC type'.
      ENDIF.
      SKIP.
      go_strucdescr ?= cl_abap_tabledescr=>describe_by_data( gs_knb1 ).
      IF ( go_strucdescr->is_ddic_type( ) = abap_true ).
        WRITE: / 'gs_knb1 is a DDIC type'.
      ELSE.
        WRITE: / 'gs_knb1 is not a DDIC type'.
      ENDIF.
    END-OF-SELECTION.
    However, if a dynpro field is based on a type defined within the program the situation may be more complex if the type includes DDIC structures (as shown above). But I am sure you will master this obstacle.
    Regards
      Uwe

  • Assigning budget profile to already existing project

    Hi All,
    Please suggest how can we assign budget  profile to already existing project .

    Hi Vishal,
    You can go the Project builder, open the particular project and in the detail screen of the project definition, enter the budget profile in the control data tab page.
    Or goto SPRO->Project system->Costs->Budget->Stipulate default budget profile for Project definition and assing the bedget profile.
    Or enter the Budget profile in the Controlling tab page of the Project profile.
    You can do all these for existing projects.
    regards
    Pratap.V

  • Already existing adapter modules in Decentralized Adapter Engine(urgent)

    hi 2 all,
    I have installed a Decentralized AE.
    I wanted to know whether i can use already existing modules in XI directly in my communication channel with my non central DAE as the adapter engine.
    Or i have to deploy SCA of those already existing modules also ??
    If i can use how to write that in modules
    regards,
    ujjwal kumar

    ya i used it but i am getting the error:
    Delivery of the message to the application using connection AFW failed, due to: Object not found in lookup of XMLAnonymizerBean
    so i might be using wrong format.
    i wrote module name as :localejbs/AF_Modules/XMLAnonymizerBean
    and module type as local enterprise bean
    regards

  • Problem setting up DVD or CD Sharing Setup - newer version already exists??

    Dudes,
    Just trying to set up install DVD or CD Sharing Setup on my MacBook so I can use Remote Disc on the Air, but have got this message on the Select A Destination screen:
    "You cannot install DVD or CD Sharing Setup on this volume. A newer version of this software already exists on this volume."
    I don't understand, as I have not installed this software yet. How can a newer version of it already exists on my MacBook?
    The only thing I can think is that perhaps they included it as standard in 10.5.6, which I have on my MacBook?
    Can anyone help at all?
    Thanks!
    Johnnycakes

    That software is bundled with the current Mac OS X version. Proceed as if it was already installed.
    (40654)

  • I get an error message when trying to sign into the support community with another Apple id. On the pick a username screen I get "an account utilizing this address already exists...." despite trying a few usernames. Anyone know how I can resolve this?

    I get an error message when trying to sign into the support community with another Apple id. On the <pick a username> screen I get "an account utilizing this address already exists.Only one account per email address is allowed on the Apple Support Communities" despite trying a few usernames. Anyone know how I can resolve this?

    This problem has been driving me demented. The instructions that Ivan gives have partially worked for me. By following his link
    "How to find out if you have multiple Apple IDs" I was able to identify that yes I did have two apple accounts using the same e mail address. One was very old that I used to use for the forum boards and one is my much more recent ID that I use for everything these days. So I changed the e mail address for the old account which is associated with these discussion boards and that's the account that I am now posting this from. However even though the two accounts now have different e mail addresses when I try to log onto the boards with my more recent main apple ID I still get all the same errors as described at the start of this thread by rodgers_j. And of course that's the one I want to use so that I only have one itunes account for everything.
    So if anyone has any more hints I'd be very grateful.

  • How do I know if a URL already exists in the bookmarks when I try to add a new bookmark?

    I have always been troubled by this problem because I have hundreds of bookmarks and I often can not remember whether a page has been saved.
    When I try to transfer to Safari from Chrome I found this very serious problem because Chrome has a reminder of duplicate bookmarks.
    I know there are some ways to find dupes and delete them. But what I want is getting a reminder about whether the bookmark already exists, and where, before the duplicate generated.
    So is there any way to solve this problem? Or will Apple make improvements in the new version in OS X 10.10?

    If you are using iCloud to sync bookmarks between devices ..
    Try >  iCloud: Troubleshooting iCloud Bookmarks and Reading List
    And here >  How to Fix Duplicate Bookmarks in iCloud

Maybe you are looking for

  • Creation of search help manually fro select-options

    hi friends i got a requirement for creating the search helps manually for select-options. but i am facing a progbalem. i am attaching a sample code for what i have written for select-opions low of which when i am pressing f4 button i am getting list

  • IPhone Web App Directory

    Does anyone know if there is a version of the Apple iPhone web app directory formatted for the iPhone? Every time I go to load the page it displays full.

  • "......." did not respond or cancelled the connection

    I keep getting this error message and I don't know what to do about it. I just got a MacBook Pro and my girlfriend just got a MacBook and we have been trying to chat with no luck. I have changed my port to 443 and changed streaming to 1.5 MPS and she

  • Photoshop elements editor problem

    can anyone help, please? I am new to photoshop elementsand am a bit frustrated. I am trying to do some editing but keep getting the message that the 'editor is busy' -' the command could not be completed because the editor was busy, Please finish the

  • Wireless Backup to External Hard Drive

    Home network: iMac (Snow Leopard), Wireless Printer, Vigor 2800 Wireless Router, 2 Seagate USB Ext Hard Drives. I wish to add Seagate hard drives to wireless network and use Time Machine for B/Up. They are currently wired directly to Mac. I have trie