LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get previous panelhandle

Solved!
Go to solution

Hello All,

 

I created 3 different panels (panelhandle1,panelhandle2,panelhandle3).

 

In panel1: When i click a button,the callback function displays the panel2 with this code :

HidePanel(panelhandle1);

DisplayPanel( panelhandle2);

 

In panel2: There is an OK button,when clicked should redisplay the panel1 with this code:

Hidepanel(panelhandle2);

DisplayPanel(panelhandle1);

 

In panel3: I want to display the same panel2,so I wrote this code:

Hidepanel(panelhandle3);

DisplayPanel(panelhandle2);

 

Now come my question. How do i get back to the previous panel(panelhandle3) when I click the same OK button.Is there any panel function,that can get the previous panel handle?Anyone with better solution or code to solve this matter?I just want to use this one OK button to go back to the previous panel

 

y_m_h

 

 

 

0 Kudos
Message 1 of 4
(3,251 Views)

y_m_h:

 

You could try something like this.

 

Create a global variable previousPanel and initialize it to 0 (default for numeric globals in ANSI C anyway).

In your OK callback for each panel, check if previousPanel is > 0.  If it is, call DisplayPanel(previousPanel), then save the current panel handle (the panel parameter passed to the callback) to the global variable previousPanel.  If previousPanel = 0, return to the main panel.

0 Kudos
Message 2 of 4
(3,243 Views)
Solution
Accepted by topic author y_m_h

y_m_h:

 

You also need to update previousPanel if there are other ways to display a panel besides hitting the OK button.

 

Take a look at the simple example I've attached.  It has a Main Panel and three other panels (A, B, and C) which go to the previous panel whenever OK is pressed.

0 Kudos
Message 3 of 4
(3,236 Views)

Hi AI S

 

Your solution has helped me a lot. I really appreciate it. It works. Thank you so much

 

 

y_m_h

0 Kudos
Message 4 of 4
(3,154 Views)