<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: loading panels in LabWindows/CVI</title>
    <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342491#M22016</link>
    <description>&lt;DIV&gt;A panel can be loaded and discarded several times: there must be some incoherence in the source code when loading and displaying the new panel.&lt;/DIV&gt;
&lt;DIV&gt;Can you post the code for "Other panel" button?&lt;/DIV&gt;</description>
    <pubDate>Thu, 23 Mar 2006 16:54:09 GMT</pubDate>
    <dc:creator>RobertoBozzolo</dc:creator>
    <dc:date>2006-03-23T16:54:09Z</dc:date>
    <item>
      <title>loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342343#M22008</link>
      <description>&lt;DIV&gt;Hi,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I was wondering if someone can help me with my problem. Basically i have a uir....on that uir i hv&amp;nbsp;callback button when pressed should load a panel that is saved under a different name from main uir.....so the first time it wrks fine.....it loads the other panel.....now on that panel i hv put a close button, and in the callback i jus say discardpanel(panelhandle).....it closes and my main window is displayed...i can make changes to that and then when i press the button to for that other panel again....it crashes i get error code -4 that is Panel, pop-up, menu bar, or plot ID is invalid.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I would appreciate if someone can help me out....&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;thanks&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;k1_ke&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Mar 2006 14:16:46 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342343#M22008</guid>
      <dc:creator>k1_ke</dc:creator>
      <dc:date>2006-03-23T14:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342480#M22014</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;does the error occur when the LoadPanel function is executed?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2006 16:49:03 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342480#M22014</guid>
      <dc:creator>Wim S</dc:creator>
      <dc:date>2006-03-23T16:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342491#M22016</link>
      <description>&lt;DIV&gt;A panel can be loaded and discarded several times: there must be some incoherence in the source code when loading and displaying the new panel.&lt;/DIV&gt;
&lt;DIV&gt;Can you post the code for "Other panel" button?&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Mar 2006 16:54:09 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342491#M22016</guid>
      <dc:creator>RobertoBozzolo</dc:creator>
      <dc:date>2006-03-23T16:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342561#M22019</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks Roberto and Wim for replying back. Roberto here is the code. i have put this in a separate .c file&lt;/P&gt;
&lt;P&gt;int CVICALLBACK EdgesCallback (int panel, int control, int event,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;void *callbackData, int eventData1, int eventData2)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;switch (event)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;case EVENT_COMMIT:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;edge_handle = LoadPanel (edge_handle, "edges.uir", EDGE);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;RecallPanelState (edge_handle, "edges.uir",1);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //loads the previous saved panel by user&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;DisplayPanel (edge_handle);&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;int CVICALLBACK CloseCallback (int panel, int control, int event,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;void *callbackData, int eventData1, int eventData2)&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;switch (event)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;case EVENT_COMMIT:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;DiscardPanel (edge_handle);&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;I dont know why but i have been loading different panels n wrks fine but all the tiem the code has been in the same main.c file....this time i hv it in another file..the first time it wrks fine....bt then after closing it, if i click on the button again i get the error msg.......it crashes at LoadPanel because the error handle is -4.&lt;/P&gt;
&lt;P&gt;I guess its something simple but hard to see. hope you can solve it for me.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;k1_ke&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2006 17:57:20 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342561#M22019</guid>
      <dc:creator>k1_ke</dc:creator>
      <dc:date>2006-03-23T17:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342628#M22023</link>
      <description>I think your problem is that you are using the same .uir file from which you load the panel, as a panel state file. When you call the SavePanelState function, the resulting file is &lt;B&gt;not&lt;/B&gt; a .uir file. It is a different format, in which only the control values are preserved. (There is no suggested extension. You can name it what you like). What is happening is that by overwriting the .uir file whenever you save the panel state, the next time you try to load a panel from the original .uir file, you won't be able to.&lt;BR /&gt;&lt;BR /&gt;Try saving the panel state in a different file, and see if the problem goes away.&lt;BR /&gt;&lt;BR /&gt;Luis&lt;BR /&gt;NI&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Mar 2006 19:40:50 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342628#M22023</guid>
      <dc:creator>LuisG</dc:creator>
      <dc:date>2006-03-23T19:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342645#M22025</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Hi, thanks for the reply. Sorry for having the RecallpanelState....i was just trying it. I didnt hv it before and still crashed even having it there no luck.....&lt;/P&gt;
&lt;P&gt;Do you think i can call a uir file which is in another .c file....and i used a button that is on my main uir (main.c)... e.g main.uir has the button.....the callback is in a file edge.c......and the panel i want to load then is edge.uir.....&lt;/P&gt;
&lt;P&gt;I will try saving it to a different panel name and get back to you.&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;k1_ke&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2006 19:57:47 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342645#M22025</guid>
      <dc:creator>k1_ke</dc:creator>
      <dc:date>2006-03-23T19:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342706#M22028</link>
      <description>You can load a panel from any .uir. The .c file doesn't matter. And it also doesn't matter which .c file the callback functions are in, as long as they're in the same EXE or DLL from which you call LoadPanel.&lt;BR /&gt;&lt;BR /&gt;Keep in mind that the problem with the .uir file was not the RecallPanelState function, per se. It was probably the &lt;B&gt;SavePanelState&lt;/B&gt; function that you presumably also had somewhere else in your code.&lt;BR /&gt;&lt;BR /&gt;Luis&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Mar 2006 21:58:57 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342706#M22028</guid>
      <dc:creator>LuisG</dc:creator>
      <dc:date>2006-03-23T21:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342861#M22042</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I think , your problem is in call LoadPanel with&amp;nbsp;invalid parent panel handle&lt;/P&gt;
&lt;P&gt;1 state :run EdgesCallback ()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;edge_handle = LoadPanel (edge_handle, "edges.uir", EDGE);//edge_handle is replace by new panel&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;2 state :run CloseCallback ()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;DiscardPanel (edge_handle);&amp;nbsp; //edge_handle is now invalid&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;3&amp;nbsp;state :run EdgesCallback ()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;edge_handle = LoadPanel (edge_handle, "edges.uir", EDGE); //invalid edge_handle is used a s parent&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;ovrabek/CZ&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by ovrabek/CZ on &lt;SPAN class="date_text"&gt;03-24-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:18 AM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2006 07:06:33 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342861#M22042</guid>
      <dc:creator>OVR_CZ</dc:creator>
      <dc:date>2006-03-24T07:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342898#M22045</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Hi k1_ke,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;I think there is another way to solve your problem, at least is how i do it when working with more than one panel, and it doesn't fail. First in the main function you load all the panels, but only display the main panel or the first you want to appear, then when you want to change from a panel to other you do:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;int CVICALLBACK EdgesCallback (int panel, int control, int event,&lt;BR /&gt;&amp;nbsp; void *callbackData, int eventData1, int eventData2)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;switch (event)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp; case EVENT_COMMIT:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; HidePanel (main_panel);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Hides/closes the main panel&lt;BR /&gt;&amp;nbsp;&amp;nbsp; DisplayPanel (edge_handle);&amp;nbsp;&amp;nbsp; //Shows/opens the edge panel&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;int CVICALLBACK CloseCallback (int panel, int control, int event,&lt;BR /&gt;&amp;nbsp; void *callbackData, int eventData1, int eventData2)&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;switch (event)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp; case EVENT_COMMIT:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; HidePanel (edge_panel);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Hides/closes the edge panel&lt;BR /&gt;&amp;nbsp;&amp;nbsp; DisplayPanel (main_handle);&amp;nbsp;&amp;nbsp; //Shows/opens the&amp;nbsp;main panel&lt;BR /&gt;&amp;nbsp;&amp;nbsp; break;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Finally before exiting the application you discard all the panels you have loaded in the beginning, so really you are working with all the panels loaded, but you only show the ones you want to show &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://ni.lithium.com/i/smilies/16x16_smiley-wink.gif" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Hope it helps you&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Juan&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2006 09:07:04 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/342898#M22045</guid>
      <dc:creator>jrodriguez</dc:creator>
      <dc:date>2006-03-24T09:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: loading panels</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/343000#M22051</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;HI Guys,&lt;/P&gt;
&lt;P&gt;Thank you very much for replying. I was able to solve my problem wiht Juan's suggestion....now i load the panels in the start and show or hide according to what i want...wrks fine.&lt;/P&gt;
&lt;P&gt;ovrabek/CZ - yeah i knew that was my problem...jus wanted to figure a way around it but Juan was able to help me out. thanks for ur help&lt;/P&gt;
&lt;P&gt;Luis G -&amp;nbsp; thank you for ur input also....yeah well see the first the it wasnt workign so i was tryin to save the panel....change the state index and load the new index.....but that wasnt doing the trick for some reason...mayb i had to change the file name too....but i hv used savepanel state in my previous project n wrks fine...bt the same method didnt here.&lt;/P&gt;
&lt;P&gt;In the end i was able to solve the problem.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;k1_ke&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2006 13:40:27 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/loading-panels/m-p/343000#M22051</guid>
      <dc:creator>k1_ke</dc:creator>
      <dc:date>2006-03-24T13:40:27Z</dc:date>
    </item>
  </channel>
</rss>

