01-11-2011 07:48 AM
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
Solved! Go to Solution.
01-11-2011 08:31 AM
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.
01-11-2011 09:07 AM
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.
01-20-2011 06:41 AM
Hi AI S
Your solution has helped me a lot. I really appreciate it. It works. Thank you so much
y_m_h